Documentation
DocumentationDiscussions
These docs are for v5.1. Click to read the latest docs for v2024.2.

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" />