Skip to content
Docs Try Aspire
Docs Try

Set up Seq in the AppHost

Seq logo

This article is the reference for the Aspire Seq hosting integration. It enumerates the AppHost APIs — with examples for both AppHost.cs and apphost.ts — that you use to model a Seq server resource in your AppHost project.

If you’re new to the Seq integration, start with the Get started with Seq integrations guide. For how consuming apps read the connection information this page exposes, see Connect to Seq.

To start building an Aspire app that uses Seq, install the 📦 Aspire.Hosting.Seq NuGet package:

Terminal
aspire add seq

Learn more about aspire add in the command reference.

Or, choose a manual installation approach:

C# — AppHost.cs
#:package Aspire.Hosting.Seq@*
XML — AppHost.csproj
<PackageReference Include="Aspire.Hosting.Seq" Version="*" />

Once you’ve installed the hosting integration in your AppHost project, you can add a Seq resource as shown in the following examples:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var seq = builder.AddSeq("seq")
.ExcludeFromManifest()
.WithLifetime(ContainerLifetime.Persistent)
.WithEnvironment("ACCEPT_EULA", "Y");
var myService = builder.AddProject<Projects.ExampleProject>()
.WithReference(seq)
.WaitFor(seq);
// After adding all resources, run the app...
  1. When Aspire adds a container image to the AppHost, as shown in the preceding example with the docker.io/datalust/seq image, it creates a new Seq instance on your local machine.

  2. The Seq container may be slow to start, so it’s best to use a persistent lifetime to avoid unnecessary restarts. For more information, see Container resource lifetime.

  3. The AppHost reference call configures a connection in the consuming project named after the referenced Seq resource, such as seq in the preceding example.

Accept the Seq End User License Agreement (EULA)

Section titled “Accept the Seq End User License Agreement (EULA)”

You must accept the Seq EULA for Seq to start. Pass the ACCEPT_EULA environment variable with a value of Y to the Seq container to accept the agreement in code, as shown in the examples above.

Seq is an observability tool intended for local development and internal environments. Call ExcludeFromManifest (C#) to prevent the Seq resource from appearing in the Aspire deployment manifest. Set up a secure, production-grade Seq server outside of Aspire for your production environment.

Add a data volume to the Seq resource to persist log data across container restarts:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var seq = builder.AddSeq("seq")
.WithDataVolume()
.ExcludeFromManifest()
.WithLifetime(ContainerLifetime.Persistent)
.WithEnvironment("ACCEPT_EULA", "Y");
var myService = builder.AddProject<Projects.ExampleProject>()
.WithReference(seq)
.WaitFor(seq);
// After adding all resources, run the app...

The data volume is used to persist the Seq data outside the lifecycle of its container. The data volume is mounted at /data in the Seq container, and when a name parameter isn’t provided, the name is generated at random. For more information on data volumes and details on why they’re preferred over bind mounts, see Docker docs: Volumes.

Add a data bind mount to the Seq resource as shown in the following examples:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var seq = builder.AddSeq("seq")
.WithDataBindMount(source: "/Seq/Data", isReadOnly: false)
.ExcludeFromManifest()
.WithLifetime(ContainerLifetime.Persistent)
.WithEnvironment("ACCEPT_EULA", "Y");
var myService = builder.AddProject<Projects.ExampleProject>()
.WithReference(seq)
.WaitFor(seq);
// After adding all resources, run the app...

Data bind mounts rely on the host machine’s filesystem to persist Seq data across container restarts. The bind mount is mounted at /data in the Seq container, and maps to C:\Seq\Data on Windows (or /Seq/Data on Unix) on the host machine. For more information on data bind mounts, see Docker docs: Bind mounts.

The Seq container exposes two endpoints:

EndpointDefault portDescription
http5341The primary ingestion and query endpoint used by consuming apps and the Seq web UI

When you call .WithReference(seq), Aspire injects the http endpoint URI into the consuming app as the SEQ_URI environment variable (or {RESOURCE}_URI for other resource names).

For the full reference of Seq connection properties — and how consuming apps in C#, TypeScript, Python, and Go read them — see Connect to Seq.

The Seq hosting integration does not automatically register a health check. Seq availability is typically verified by the consuming app’s client integration or by using .WaitFor(seq) in the AppHost to delay dependent resources until the Seq container is ready.