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

Importing Log Files

Use seq-import.exe to import flat log files

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

The seq-import.exe command-line tool can read canonical JSON files created by Serilog and upload them through the Seq API.

📘

The SeqFlatFileImport tool from Octopus Deploy is an alternative that's capable of reading unstructured (plain text) and IIS log files.

Installation

Requires .NET 4.5 or better.

With Chocolatey:

choco install seq-import

Or, download the source code from GitHub and build/run locally.

Usage

The importer is a command-line application.

seq-import: Import JSON log files into Seq.

Usage:
    seq-import.exe <file> <server> [--apikey=<k>]
    seq-import.exe (-h | --help)

Options:
    -h --help     Show this screen.
    <file>        The file to import.
    <server>      The Seq server URL.
    --apikey=<k>  Seq API key.

Example:

seq-import.exe myapp.json https://my-seq --apikey=jhfaty89thfajkafhkl

The command will print a GUID ImportId, which will also be attached to the imported events in Seq.

Creating compatible JSON files with Serilog

The import tool uses Serilog's canonical JSON format. To create a file in this format, either:

  • Specify a Serilog.Formatting.Json.JsonFormatter as the ITextFormatter for a log event sink;
  • Use a sink from Serilog.Sinks.Json; or,
  • Configure your logging library to write files using the format specified below.

File format

Newline-separated JSON is the only format currently supported. The fields are:

FieldContent
TimestampAn ISO 8601 timestamp with optional timezone
Level (optional)Either Verbose, Debug, Information, Warning, Error, Fatal
MessageTemplateA Serilog-compatible message template
Properties (optional)A dictionary of property values
Renderings (optional)A dictionary of programming-language-specific formattings of properties that appear in the message template