DocumentationDiscussions
DocumentationDiscussions
Hey! These docs are for version 5.1, which is no longer officially supported. Click here for the latest version, 2022.1!

Importing Log Files

Use seqcli to import plain-text and JSON log files

Applications that need to log to a local file can write them in JSON format for easy importing into Seq.

The recommended format is Compact Log Event Format, produced by Serilog.Formatting.Compact.

Both CLEF and plain-text log files can be imported into Seq using the Command-line Client's seqcli ingest command.

Creating compatible JSON files with Serilog

The most common way to create CLEF files is by specifying CompactJsonFormatter when configuring a Serilog sink, for example the file sink.

This must be installed from NuGet first:

Install-Package Serilog.Sinks.File
Install-Package Serilog.Formatting.Compact

The formatter is passed either in C# configuration:

Log.Logger = new LoggerConfiguration()
  .WriteTo.File(new CompactJsonFormatter(), "./logs/myapp.json")
  .CreateLogger();

Or via XML <appSettings>:

<appSettings>
  <add key="serilog:using:File" value="Serilog.Sinks.File" />
  <add key="serilog:write-to:File.path" value="./logs/myapp.json" />
  <add key="serilog:write-to:File.formatter"
       value="Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />

Did this page help you?