/seq-import

A CLI tool for importing JSON-formatted log files directly into Seq

Primary LanguageC#Apache License 2.0Apache-2.0

seq-import.exe Build status Chocolatey

A CLI tool for importing JSON-formatted log files directly into Seq.

seq-import: Import JSON log files into Seq.

Usage:
    seq-import.exe <file> <server> [--apikey=<k>] [--p:<key>=<value>]
    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.
    --p:<key>=<value>   Add tag(s) to import.

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.

seq-import.exe myapp.json https://my-seq --p:user=myappuser1 --p:email=myappuser@email.com

The command will attach the following tags: user and email to all imported events in Seq.

Installation

Requires .NET 4.5 or better.

With Chocolatey:

choco install seq-import

Or, download a zip file of the source code and build/run locally.

File format

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

  • Timestamp - an ISO 8601 timestamp with optional timezone
  • Level - (optional) either Verbose, Debug, Information, Warning, Error, Fatal
  • MessageTemplate - a 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

Creating compatible JSON files with Serilog

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

  1. Specify a Serilog.Formatting.Json.JsonFormatter as the ITextFormatter for a log event sink; or,
  2. Use a sink from Serilog.Sinks.Json.