Send .NET Serilog Logs to SigNoz Using OpenTelemetry

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

This guide shows how to send logs from a .NET application to SigNoz. The application must use the Serilog logging library. The setup uses the official Serilog.Sinks.OpenTelemetry sink. This sink sends logs directly over OTLP, so it does not need the OpenTelemetry .NET SDK.

Prerequisites

Send logs to SigNoz

Step 1: Install the sink

Add the Serilog.Sinks.OpenTelemetry package to your project:

dotnet add package Serilog.Sinks.OpenTelemetry

This installs the latest version. If your project pins an older version, upgrade to v4.0.0 or later. Earlier versions ignore OTEL_SERVICE_NAME and the other OTEL_EXPORTER_OTLP_* environment variables used in Step 3.

Step 2: Configure the sink

Add the OpenTelemetry sink to your Serilog logger configuration. Do this where you build Log.Logger, usually at the start of Program.cs. Leave out the endpoint, protocol, and headers here. The sink reads them from environment variables at startup:

Program.cs
using Serilog;
 
Log.Logger = new LoggerConfiguration()
    .WriteTo.Console()
    .WriteTo.OpenTelemetry()
    .CreateLogger();
 
try
{
    // Your application code
}
finally
{
    Log.CloseAndFlush();
}

This works in any .NET application, including .NET Framework 4.6.2 and later.

Step 3: Set environment variables and run

export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
export OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
export OTEL_SERVICE_NAME="<service_name>"
dotnet run

Verify these values:

Correlate logs with traces

The sink adds trace_id and span_id to each log record from the current Activity. This happens automatically and needs no extra code.

For this correlation to work, your application must also send traces to SigNoz. Follow the .NET tracing guide to set up an AddOtlpExporter trace pipeline alongside this log sink.

Validate

  1. Generate some log activity in your application.
  2. Open SigNoz and go to Logs.
  3. Filter by your service.name to find your log records.
Serilog logs from a .NET application in SigNoz
Serilog logs sent to SigNoz through the OpenTelemetry sink

Troubleshooting

Logs do not appear in SigNoz

  • Make sure that OTEL_EXPORTER_OTLP_PROTOCOL matches the endpoint. Use http/protobuf with port 443 (Cloud) or 4318 (self-hosted). Use grpc with port 4317 on self-hosted.
  • Make sure that the ingestion key header uses the exact key signoz-ingestion-key.
  • Make sure that <region> matches your SigNoz Cloud region.

Connection refused or timeout errors

  • Cloud: Make sure that outbound HTTPS traffic on port 443 is allowed.
  • Self-hosted: Make sure that the collector runs and listens on the port your protocol needs.

Logs appear without trace_id or span_id

  • Make sure that your application configures OpenTelemetry tracing, as described in Correlate logs with traces.
  • Log calls made outside an active Activity do not carry trace context.

Next Steps

Get Help

If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack. If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.

Is this page helpful

Last updatedAugust 09, 2026

Edit on GitHub