Adding HTTP/protobuf support to OpenTelemetry log ingestion

Just yesterday we posted an update on Seq's support for the OpenTelemetry logs protocol. One slightly painful limitation, which resulted in quite a bit of extra setup complexity, was support for the gRPC transport only.

Well, today's a new day! And you can now install Seq 2023.2.9311-pre from the downloads page or pull datalust/seq:preview from Docker Hub to get support for OpenTelemetry log ingestion over plain old HTTP or HTTPS 😎.

There are no special setup instructions - once you've installed it/updated, point your instrumentation to Seq's /ingest/otlp/v1/logs endpoint and choose "HTTP/protobuf" as the transport option, and you're good to go.

Here's how it looks using OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs and Microsoft.Extensions.Logging:

var builder = WebApplication.CreateBuilder(args);

// Other configuration ...

builder.Services.AddLogging(logging => logging.AddOpenTelemetry(openTelemetryLoggerOptions =>
{
    openTelemetryLoggerOptions.SetResourceBuilder(
        ResourceBuilder.CreateEmpty()
            .AddService("GettingStarted")
            .AddAttributes(new Dictionary<string, object>
            {
                ["deployment.environment"] = "development"
            }));
        
    openTelemetryLoggerOptions.IncludeScopes = true;
    openTelemetryLoggerOptions.IncludeFormattedMessage = true;
    
    openTelemetryLoggerOptions.AddOtlpExporter(exporter =>
    {
        // The full endpoint path is required here, when using
        // the `HttpProtobuf` protocol option.
        exporter.Endpoint = new Uri("http://localhost:5341/ingest/otlp/v1/logs");
        exporter.Protocol = OtlpExportProtocol.HttpProtobuf;
    });
}));

var app = builder.Build();

This is almost identical to yesterday's code sample, except for the Endpoint and Protocol options configured for the exporter.

The resulting log events are the same:

Seq events screen showing the query @Resource['service.name'] = 'GettingStarted' and example matching events.

The great thing about plain HTTP log ingestion is that it makes Seq a perfect target for OpenTelemetry logs during development. There aren't too many other native OpenTelemetry log servers that you can start up locally with a 30 second MSI install or single docker run command and no additional configuration. We hope you'll enjoy it enough to miss it in production if you're not already running Seq there 😉 and of course that's where our sights are firmly set for a GA release in the not-too-distant future.

As always we're eager for bug reports and your ideas for improvement, here, on GitHub, or if you're tracking OpenTelemetry closely enough to be on the CNCF Slack, you can ping me (@nblumhardt) there.

Nicholas Blumhardt

Read more posts by this author.