Serilog.Sinks.Seq 7.0.0-dev-00280

Serilog.Sinks.Seq Build status NuGet

A Serilog sink that writes events to the Seq structured log server. Supports all modern .NET platforms.

Package Logo

Getting started

Install Serilog.Sinks.Seq into your .NET project:

> dotnet add package Serilog.Sinks.Seq

Point the logger to Seq:

Log.Logger = new LoggerConfiguration()
    .WriteTo.Seq("http://localhost:5341")
    .CreateLogger();

And use the Serilog logging methods to associate named properties with log events:

Log.Error("Failed to log on user {ContactId}", contactId);

Then query log event properties like ContactId from the browser:

Query in Seq

When the application shuts down, ensure any buffered events are propertly flushed to Seq by disposing the logger or calling Log.CloseAndFlush():

Log.CloseAndFlush();

The sink can take advantage of Seq's API keys to authenticate clients and dynamically attach properties to events at the server-side. To use an API key, specify it in the apiKey parameter of WriteTo.Seq().

XML <appSettings> configuration

To adjust the Seq server URL at deployment time, it's often convenient to configure it using XML <appSettings>, in the App.config or Web.config file.

Before Serilog can be configured using XML, the Serilog.Settings.AppSettings package must be installed and enabled using the LoggerConfiguration:

Log.Logger = new LoggerConfiguration()
    .ReadFrom.AppSettings()
    .CreateLogger();

When XML is used for configuration, it's not necessary to include the WriteTo.Seq() method. It is important however that the Serilog.Sinks.Seq.dll assembly is present alongside the app's binaries.

The settings typically included are:

<configuration>
  <appSettings>
    <add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
    <add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
    <add key="serilog:write-to:Seq.apiKey" value="[optional API key here]" />

Serilog's XML configuration has several other capabilities that are described on the Serilog wiki.

JSON appsettings.json configuration

To use the Seq sink with Microsoft.Extensions.Configuration, for example with ASP.NET Core or .NET Core, use the Serilog.Settings.Configuration package. First install that package if you have not already done so:

dotnet add package Serilog.Settings.Configuration

Instead of configuring the Seq sink directly in code, call ReadFrom.Configuration():

var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

var logger = new LoggerConfiguration()
    .ReadFrom.Configuration(configuration)
    .CreateLogger();

In your appsettings.json file, under the Serilog node, :

{
  "Serilog": {
    "WriteTo": [
      { "Name": "Seq", "Args": { "serverUrl": "http://localhost:5341" } }
    ]
  }
}

See the XML <appSettings> example above for a discussion of available Args options.

Dynamic log level control

The Seq sink can dynamically adjust the logging level up or down based on the level associated with an API key in Seq. To use this feature, create a LoggingLevelSwitch to control the MinimumLevel, and pass this in the controlLevelSwitch parameter of WriteTo.Seq():

var levelSwitch = new LoggingLevelSwitch();

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.ControlledBy(levelSwitch)
    .WriteTo.Seq("http://localhost:5341",
                 apiKey: "yeEZyL3SMcxEKUijBjN",
                 controlLevelSwitch: levelSwitch)
    .CreateLogger();

The equivalent configuration in XML (Serilog 2.6+) is:

<configuration>
  <appSettings>
    <!-- declare the switch -->
    <add key="serilog:level-switch:$controlSwitch" value="Information" />
    <!-- use it to control the root logger -->
    <add key="serilog:minimum-level:controlled-by" value="$controlSwitch" />
    <add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
    <add key="serilog:write-to:Seq.serverUrl" value="http://localhost:5341" />
    <add key="serilog:write-to:Seq.apiKey" value="yeEZyL3SMcxEKUijBjN" />
    <!-- give the sink access to the switch -->
    <add key="serilog:write-to:Seq.controlLevelSwitch" value="$controlSwitch" />

The equivalent configuration in JSON is:

{
    "Serilog":
    {
        "LevelSwitches": { "$controlSwitch": "Information" },
        "MinimumLevel": { "ControlledBy": "$controlSwitch" },
        "WriteTo":
        [{
            "Name": "Seq",
            "Args":
            {
                "serverUrl": "http://localhost:5341",
                "apiKey": "yeEZyL3SMcxEKUijBjN",
                "controlLevelSwitch": "$controlSwitch"
            }
        }]
    }
}

For further information see the Seq documentation.

Troubleshooting

Nothing showed up, what can I do?

If events don't appear in Seq after pressing the refresh button in the filter bar, either your application was unable to contact the Seq server, or else the Seq server rejected the log events for some reason.

Server-side issues

The Seq server may reject incoming events if they're missing a required API key, if the payload is corrupted somehow, or if the log events are too large to accept.

Server-side issues are diagnosed using the Seq Ingestion Log, which shows the details of any problems detected on the server side. The ingestion log is linked from the Settings > Diagnostics page in the Seq user interface.

Client-side issues

If there's no information in the ingestion log, the application was probably unable to reach the server because of network configuration or connectivity issues. These are reported to the application through Serilog's SelfLog.

Add the following line after the logger is configured to print any error information to the console:

Serilog.Debugging.SelfLog.Enable(Console.Error);

If the console is not available, you can pass a delegate into SelfLog.Enable() that will be called with each error message:

Serilog.Debugging.SelfLog.Enable(message => {
    // Do something with `message`
});

Troubleshooting checklist

  • Check the Seq Ingestion Log, as described in the Server-side issues section above.
  • Turn on the Serilog SelfLog as described above to check for connectivity problems and other issues on the client side.
  • Make sure your application calls Log.CloseAndFlush(), or disposes the root Logger, before it exits - otherwise, buffered events may be lost.
  • If your app is a Windows console application, it is also important to close the console window by exiting the app; Windows console apps are terminated "hard" if the close button in the title bar is used, so events buffered for sending to Seq may be lost if you use it.
  • Raise an issue, ask for help on the Seq support forum or email support@datalust.co.

Showing the top 20 packages that depend on Serilog.Sinks.Seq.

Packages Downloads
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
10
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
9
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
6
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
5
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
4
Skoruba.Duende.IdentityServer.Admin.UI.Api
API endpoints for the administration of the Duende IdentityServer
3

.NET 6.0

.NET Standard 2.0

Version Downloads Last updated
9.1.0 5 20.05.2026
9.1.0-dev-02312 3 20.05.2026
9.1.0-dev-02311 3 20.05.2026
9.0.0 11 03.06.2025
9.0.0-dev-02307 3 20.05.2026
9.0.0-dev-02304 12 04.06.2025
9.0.0-dev-02303 12 04.06.2025
9.0.0-dev-02301 13 04.06.2025
9.0.0-dev-00310 13 04.06.2025
8.0.1-dev-00309 13 04.06.2025
8.0.0 13 03.06.2025
8.0.0-dev-00305 12 04.06.2025
8.0.0-dev-00302 13 04.06.2025
8.0.0-dev-00299 12 04.06.2025
8.0.0-dev-00297 12 04.06.2025
8.0.0-dev-00295 12 04.06.2025
7.0.1 12 03.06.2025
7.0.1-dev-00291 12 04.06.2025
7.0.1-dev-00288 12 04.06.2025
7.0.1-dev-00286 12 04.06.2025
7.0.0 13 03.06.2025
7.0.0-dev-00282 12 04.06.2025
7.0.0-dev-00280 12 04.06.2025
7.0.0-dev-00278 13 04.06.2025
7.0.0-dev-00276 12 04.06.2025
6.0.0 12 03.06.2025
6.0.0-dev-00273 13 04.06.2025
6.0.0-dev-00268 13 04.06.2025
6.0.0-dev-00266 12 04.06.2025
5.2.3 12 03.06.2025
5.2.3-dev-00262 13 04.06.2025
5.2.3-dev-00260 12 04.06.2025
5.2.3-dev-00257 11 04.06.2025
5.2.2 12 03.06.2025
5.2.2-dev-00247 13 04.06.2025
5.2.1 11 03.06.2025
5.2.1-dev-00246 12 04.06.2025
5.2.1-dev-00245 13 04.06.2025
5.2.0 12 03.06.2025
5.2.0-dev-00239 13 04.06.2025
5.2.0-dev-00236 12 04.06.2025
5.2.0-dev-00234 13 04.06.2025
5.1.2-dev-00232 12 04.06.2025
5.1.2-dev-00229 13 04.06.2025
5.1.2-dev-00225 12 04.06.2025
5.1.2-dev-00222 13 04.06.2025
5.1.1 10 03.06.2025
5.1.1-dev-00218 12 04.06.2025
5.1.0 12 03.06.2025
5.1.0-dev-00214 14 04.06.2025
5.1.0-dev-00206 13 04.06.2025
5.0.2-dev-00203 12 04.06.2025
5.0.1 12 02.06.2025
5.0.1-dev-00190 13 04.06.2025
5.0.0 13 03.06.2025
5.0.0-dev-00184 13 04.06.2025
5.0.0-dev-00174 12 04.06.2025
5.0.0-dev-00172 12 04.06.2025
4.1.0-dev-00166 12 04.06.2025
4.0.1-dev-00159 12 04.06.2025
4.0.1-dev-00157 13 04.06.2025
4.0.1-dev-00155 13 04.06.2025
4.0.1-dev-00154 13 04.06.2025
4.0.0 12 03.06.2025
4.0.0-dev-00150 13 04.06.2025
4.0.0-dev-00148 12 04.06.2025
3.4.0 12 03.06.2025
3.4.0-dev-00134 12 04.06.2025
3.3.4-dev-00129 13 04.06.2025
3.3.4-dev-00126 13 01.06.2025
3.3.3 12 03.06.2025
3.3.3-dev-00122 13 04.06.2025
3.3.2 14 03.06.2025
3.3.2-dev-00118 12 04.06.2025
3.3.1 13 03.06.2025
3.3.1-dev-00114 13 04.06.2025
3.3.0 12 03.06.2025
3.3.0-dev-00110 12 04.06.2025
3.2.0 12 03.06.2025
3.2.0-dev-00105 13 04.06.2025
3.1.2-dev-00103 13 04.06.2025
3.1.2-dev-00100 13 04.06.2025
3.1.1 13 03.06.2025
3.1.1-dev-00096 11 04.06.2025
3.1.0 13 03.06.2025
3.1.0-dev-00092 13 04.06.2025
3.1.0-dev-00090 13 04.06.2025
3.0.2-dev-00088 12 04.06.2025
3.0.2-dev-00086 13 04.06.2025
3.0.1 12 03.06.2025
3.0.1-dev-00082 13 31.05.2025
3.0.0 12 03.06.2025
3.0.0-dev-00077 12 04.06.2025
3.0.0-dev-00076 12 04.06.2025
3.0.0-dev-00071 11 04.06.2025
3.0.0-dev-00069 13 04.06.2025
3.0.0-dev-00067 13 04.06.2025
2.0.1 12 03.06.2025
2.0.1-dev-00065 11 04.06.2025
2.0.0 11 03.06.2025
2.0.0-rc-57 11 04.06.2025
2.0.0-rc-55 10 04.06.2025
2.0.0-rc-51 12 04.06.2025
2.0.0-rc-48 11 04.06.2025
2.0.0-rc-46 11 04.06.2025
2.0.0-beta-42 11 04.06.2025
2.0.0-beta-41 10 04.06.2025
2.0.0-beta-39 10 04.06.2025
2.0.0-beta-38 11 04.06.2025
2.0.0-beta-34 10 04.06.2025
2.0.0-beta-33 10 04.06.2025
2.0.0-beta-32 11 04.06.2025
2.0.0-beta-31 11 04.06.2025
2.0.0-beta-30 11 04.06.2025
2.0.0-beta-29 12 04.06.2025
2.0.0-beta-28 11 04.06.2025
2.0.0-beta-25 10 04.06.2025
2.0.0-beta-23 10 04.06.2025
2.0.0-beta-22 10 04.06.2025
1.5.36 11 03.06.2025
1.5.27 10 03.06.2025
1.5.24 10 03.06.2025
1.5.17 11 03.06.2025
1.5.15 11 03.06.2025
1.5.14 10 03.06.2025
1.5.11 10 03.06.2025
1.5.9 10 03.06.2025
1.5.8 13 03.06.2025
1.5.7 13 03.06.2025
1.5.6 12 03.06.2025
1.5.5 12 03.06.2025
1.5.4 12 03.06.2025
1.5.3 12 03.06.2025
1.5.2 12 03.06.2025
1.5.1 12 03.06.2025
1.4.196 11 03.06.2025
1.4.182 11 03.06.2025
1.4.168 12 03.06.2025
1.4.155 12 03.06.2025
1.4.139 11 03.06.2025
1.4.118 11 03.06.2025
1.4.113 10 03.06.2025
1.4.102 11 03.06.2025
1.4.99 11 03.06.2025
1.4.97 11 03.06.2025
1.4.76 11 03.06.2025
1.4.39 11 03.06.2025
1.4.34 12 03.06.2025
1.4.28 12 03.06.2025
1.4.27 10 03.06.2025
1.4.23 10 03.06.2025
1.4.21 11 03.06.2025
1.4.18 12 03.06.2025
1.4.15 0 04.11.2014
1.4.14 0 23.10.2014
1.4.13 0 23.10.2014
1.4.12 0 12.10.2014
1.4.11 0 08.10.2014
1.4.10 0 26.09.2014
1.4.9 0 17.09.2014
1.4.8 0 11.09.2014
1.4.7 0 01.09.2014
1.4.6 0 31.08.2014
1.4.5 0 27.08.2014
1.4.4 0 27.08.2014