Seq.Syntax 2.0.0-dev-00103

This is a prerelease version of Seq.Syntax.
dotnet add package Seq.Syntax --version 2.0.0-dev-00103
                    
NuGet\Install-Package Seq.Syntax -Version 2.0.0-dev-00103
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Seq.Syntax" Version="2.0.0-dev-00103" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Seq.Syntax" Version="2.0.0-dev-00103" />
                    
Directory.Packages.props
<PackageReference Include="Seq.Syntax" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Seq.Syntax --version 2.0.0-dev-00103
                    
#r "nuget: Seq.Syntax, 2.0.0-dev-00103"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Seq.Syntax@2.0.0-dev-00103
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Seq.Syntax&version=2.0.0-dev-00103&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Seq.Syntax&version=2.0.0-dev-00103&prerelease
                    
Install as a Cake Tool

Seq Syntax

This repository implements Seq-style expressions and the Seq template language over structured event data.

Expressions and templates evaluate against event JSON documents in Seq's emission schema — the format delivered to Seq apps and API consumers — represented as System.Text.Json.Nodes.JsonObject:

var eventJson = JsonNode.Parse(json)!.AsObject();

var expr = SeqExpression.Compile("@Level = 'Warning' and Contains(@Message, 'coffee')");
if (expr(eventJson).IsTrue()) { /* ... */ }

var template = new ExpressionTemplate("[{@Timestamp:HH:mm:ss} {@Level:u3}] {@Message}");
template.Format(eventJson, Console.Out);

Keyword properties (@Timestamp, @Level, @Message, …) provide typed views over the document's @t, @l, @mt/@m fields and friends; any other @ identifier reads the correspondingly-named document member verbatim.

Migrating from 1.x: version 2.0 removed the Serilog dependency and is a breaking change — SerilogExpression became SeqExpression, LogEvent inputs became JsonObject, and @t, @l, @m, and other short @ names became plain JSON reads.

Error in {Environment}!

Here, Environment is an event property, producing a message subject like Error in Production!.

Basic syntax

Templates support:

  • Most built-in Seq event properties, including @Level, @Message, and @Exception,
  • First-class properties of events and alerts, like Environment in the example above,
  • Most Seq scalar functions, such as ToIsoString(), Coalesce(), Substring(), IndexOf(), and so on,
  • Seq operators such as =, <>, <, >, like, in, is null,
  • Constant numbers 123.4, strings 'abc', Boolean true and false, and null,
  • Arrays delimited with brackets [] and zero-based indexing,
  • Object literals using braces {} that support string-based indexing,
  • Most other Seq expression language features.

Literal braces in templated text fields can be escaped by doubling, {{ and }}.

Formatting of dates and numbers can be achieved using .NET format strings following a colon, e.g.:

Completed in {Elapsed:0.00} ms

Conditionals and repetition

To conditionally include text, use {#if expr}:

{#if Count = 0}
  Nothing here
{#else if Count = 1}
  Only one
{#else}
  Found {Count} items
{#end}

The else/else if blocks are optional.

To iterate over array elements or object properties use {#each e in expr} or {#each k, v in expr}:

{#each name, value in @Properties}
  {name} is {value}
{#delimit}
  ---
{#else}
  No properties
{#end}

The delimit and else blocks are optional.

ANSI terminal output

Pass one of the built-in themes (Code, Grayscale, Literate, or Sixteen) to color terminal output:

var template = new ExpressionTemplate(
    "[{@Timestamp:HH:mm:ss} {@Level:u3}] {@Message}\n{@Exception}",
    encoder: TemplateOutputEncoder.Ansi(TemplateTheme.Code));

Themes can be customized by overriding the styles of a base theme:

var custom = new AnsiTheme((AnsiTheme)TemplateTheme.Literate, new Dictionary<TemplateThemeStyle, string>
{
    [TemplateThemeStyle.LevelInformation] = "\x1b[38;5;34m",
});

Escaping text inserted into HTML message bodies

TemplateOutputEncoder.Html escapes event-derived values automatically, so they can be safely inserted into HTML attributes and element bodies (excluding script and style contexts, in which no safe escaping is possible).

var template = new ExpressionTemplate(
    "<p>{@Message}</p>",
    encoder: TemplateOutputEncoder.Html);

Where an event property is known to contain trusted, well-formed HTML, {unsafe(Markup)} substitutes it without escaping.

Acknowledgements

This project is based on code from Serilog and Serilog.Expressions.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Seq.Syntax:

Package Downloads
Seq.Input.HealthCheck

Seq Health Check: periodically GET an HTTP resource and publish response metrics to Seq.

Seq.Mail

Shared infrastructure for Seq apps that integrate with email and similar messaging services.

Seq.App.HttpRequest

Send events and notifications from Seq to a remote HTTP/REST/WebHook endpoint.

Seq.App.AzureSecretCheck

This plug-in checks the secrets and certificates of each of the apps specified and returns the days till expiration of each item.

Seq.App.Relay

A simple HTTP/JSON forwarder that preserves all event metadata.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Seq.Syntax:

Repository Stars
datalust/seqcli
The Seq command-line client. Administer, log, ingest, search, from any OS.
Version Downloads Last Updated
2.0.0-dev-00103 32 9/3/2026
2.0.0-dev-00102 30 9/3/2026
2.0.0-dev-00101 29 9/3/2026
2.0.0-dev-00100 46 9/1/2026
2.0.0-dev-00099 65 9/1/2026
2.0.0-dev-00098 98 9/1/2026
2.0.0-dev-00097 111 8/31/2026
2.0.0-dev-00096 72 8/31/2026
2.0.0-dev-00095 72 8/31/2026
1.2.0 207 8/6/2026
1.2.0-dev-00109 195 8/17/2026
1.1.2-dev-00106 197 8/6/2026
1.1.2-dev-00105 210 8/6/2026
1.1.2-dev-00102 196 8/5/2026
1.1.1 3,744 3/10/2026
1.1.1-dev-00098 214 3/10/2026
1.1.1-dev-00097 226 3/10/2026
1.1.0 2,049 10/1/2025
1.1.0-dev-00093 326 10/1/2025
1.1.0-dev-00092 400 10/1/2025
Loading failed