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

Writing Seq Apps in Other Languages

Seq apps can be written as standard processes in any language, with configuration read from environment variables, read events from stdin and write events to stderr.

For a detailed walkthrough of writing a Seq app, using Rust as an example, see Writing a simple Seq App in Rust.

Specifying settings in the app definition

To tell Seq which settings are available for an app, we need to package an app definition file alongside the executable. Here's an example app definition with a single setting called propertyToTotal:

{
  "name": "Total Example",
  "description": "Keeps and prints a running total of a numeric property.",
  "executable": "total.exe", 
  "settings": {
    "propertyToTotal": {
      "displayName": "Property to total",
      "helpText": "The name of a numeric property for the app to detect and report the total of."
    }
  }
}

Reading settings from the environment

Apps can accept settings that a Seq user provides through the UI when configuring an app instance.

The value we provide will be passed to the app in an environment variable named using the pattern SEQ_APP_SETTING_*, where * is the setting name. For example, a setting called propertyToTotal will be available to a running app as an environment variable called SEQ_APP_SETTING_PROPERTYTOTOTAL.

Reading input events from stdin

Once the app process is started, Seq will write events as JSON documents, one per line, to the app’s standard input.

The events themselves are in the compact JSON format written by Serilog.Formatting.Compact. A typical event might look like:

{"@t":"2017-08-25T14:55:32.456","@mt":"Dispensed {Volume} L","Volume":10.1}

Writing output events to stderr

Most Seq apps don’t write events back to Seq, or only do this to report problems.

Since it can be hard to prevent some libraries writing junk to stdout, Seq reads output events from stderr instead (arguably, stderr is the right place for diagnostic output anyway). The output format is the same as the input: compact JSON documents, one per line.

Supplied environment variables

Seq will set the following environment variables for the app to consume.

Environment variablePurposeExample value
SEQ_APP_IDThe id of the Seq app instance being executedappinstance-123
SEQ_APP_TITLEThe title of the Seq app instance being executedEmail Dev Team
SEQ_APP_STORAGEPATHA directory in which app-specific data can be stored/data/my-app
SEQ_INSTANCE_BASEURIThe base URI of the Seq server that is hosting the apphttps://seq.example.com
SEQ_INSTANCE_NAMEThe instance name of the Seq server that is hosting the appProduction