Installing Serilog You will need to add the Serilog and Serilog.Sinks.Network packages. This guide will also use appSettings to configure Serilog.

Install-Package Serilog
Install-Package Serilog.Sinks.Network
Install-Package Serilog.Settings.AppSettings

Configuring Serilog

Add AppSettings to your app.config or web.config.

        <!-- Level of logging -->
        <add key="serilog:minimum-level" value="Verbose" />
        <!-- Use the TCP Network sink -->
        <add key="serilog:using:TCPSink" value="Serilog.Sinks.Network" />
        <!-- Your logstash configuration -->
        <add key="serilog:write-to:TCPSink.uri" value="tls://your-logstash-host:your-port" />            

The serilog:write-to:TCPSink.uri value must be in the format "protocol://domain:port".

Using Serilog

Create a statically accessible Logger configured from AppSettings.

Log.Logger = new LoggerConfiguration()

You can now log from anywhere in your application.

Log.Information("The global logger has been configured");

Serilog is a fully featured logging framework and has many other capabilities that are not detailed here, please see the Serilog Documentation for more information.