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
- A supported .NET version or .NET Framework 4.6.2 or later
- A .NET application that already logs with Serilog
- An instance of SigNoz (either Cloud or Self-Hosted)
Send logs to SigNoz
Step 1: Install the sink
Add the Serilog.Sinks.OpenTelemetry package to your project:
dotnet add package Serilog.Sinks.OpenTelemetryThis 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:
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 runVerify these values:
<region>: Your SigNoz Cloud region.<your-ingestion-key>: Your SigNoz ingestion key.<service_name>: Your service name.
Add these environment variables to your deployment manifest:
env:
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: 'http/protobuf'
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: 'https://ingest.<region>.signoz.cloud:443'
- name: OTEL_EXPORTER_OTLP_HEADERS
value: 'signoz-ingestion-key=<your-ingestion-key>'
- name: OTEL_SERVICE_NAME
value: '<service_name>'Verify these values:
<region>: Your SigNoz Cloud region.<your-ingestion-key>: Your SigNoz ingestion key.<service_name>: Your service name.
Apply the updated manifest, then restart the deployment so running pods pick up the new environment variables:
kubectl apply -f <deployment-file>.yaml
kubectl rollout restart deployment/<deployment-name>Add these environment variables to your Dockerfile:
ENV OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
ENV OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443"
ENV OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
ENV OTEL_SERVICE_NAME="<service_name>"Verify these values:
<region>: Your SigNoz Cloud region.<your-ingestion-key>: Your SigNoz ingestion key.<service_name>: Your service name.
Rebuild the image and restart the container so it picks up the new variables:
docker build -t <image-name> .
docker run <image-name>Set environment variables in PowerShell:
$env:OTEL_EXPORTER_OTLP_PROTOCOL = "http/protobuf"
$env:OTEL_EXPORTER_OTLP_ENDPOINT = "https://ingest.<region>.signoz.cloud:443"
$env:OTEL_EXPORTER_OTLP_HEADERS = "signoz-ingestion-key=<your-ingestion-key>"
$env:OTEL_SERVICE_NAME = "<service_name>"
dotnet runVerify these values:
<region>: Your SigNoz Cloud region.<your-ingestion-key>: Your SigNoz ingestion key.<service_name>: Your service name.
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
- Generate some log activity in your application.
- Open SigNoz and go to Logs.
- Filter by your
service.nameto find your log records.

Troubleshooting
Logs do not appear in SigNoz
- Make sure that
OTEL_EXPORTER_OTLP_PROTOCOLmatches the endpoint. Usehttp/protobufwith port 443 (Cloud) or 4318 (self-hosted). Usegrpcwith 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
Activitydo 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.