Salta ai contenuti
Docs Try Aspire
Docs Try

Seq client integration

Questi contenuti non sono ancora disponibili nella tua lingua.

Seq logo

To get started with the Seq client integration, install the 📦 Aspire.Seq NuGet package in the client-consuming project:

.NET CLI — Add Aspire.Seq package
dotnet add package Aspire.Seq

In the Program.cs file of your client-consuming project, call the AddSeqEndpoint extension method to register OpenTelemetry Protocol exporters to send logs and traces to Seq:

builder.AddSeqEndpoint(connectionName: "seq");

When you reference a Seq resource using WithReference, the following connection properties are made available to the consuming project:

The Seq resource exposes the following connection properties:

Property NameDescription
HostThe hostname or IP address of the Seq server
PortThe port number the Seq server is listening on
UriThe connection URI, with the format http://{Host}:{Port}

Example connection string:

Uri: http://localhost:5341

The Seq integration provides multiple options to configure the connection to Seq.

The Seq integration supports Microsoft.Extensions.Configuration. It loads the SeqSettings from configuration using the Aspire:Seq key. Example appsettings.json:

{
"Aspire": {
"Seq": {
"DisableHealthChecks": true,
"ServerUrl": "http://localhost:5341"
}
}
}

The Seq integration supports named configuration for multiple instances:

{
"Aspire": {
"Seq": {
"seq1": {
"ServerUrl": "http://seq1:5341",
"DisableHealthChecks": true
},
"seq2": {
"ServerUrl": "http://seq2:5341",
"DisableHealthChecks": false
}
}
}
}

Use the connection names when calling AddSeqEndpoint:

builder.AddSeqEndpoint("seq1");
builder.AddSeqEndpoint("seq2");

You can pass the Action<SeqSettings> delegate to set up options inline:

builder.AddSeqEndpoint("seq", static settings =>
{
settings.DisableHealthChecks = true;
settings.ServerUrl = "http://localhost:5341";
});

By default, Aspire integrations enable health checks for all services. The Seq integration:

  • Adds the health check when DisableHealthChecks is false, which attempts to connect to the Seq server’s /health endpoint.
  • Integrates with the /health HTTP endpoint.

The Seq integration uses the following log categories:

  • Seq

The Seq integration doesn’t emit tracing activities or metrics because it’s a telemetry sink, not a telemetry source.