Correlate Traces and Logs

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

SigNoz lets you jump from a trace directly to the logs that fired during it, and from a log entry back to the trace that caused it. This works because OpenTelemetry SDKs inject trace_id and span_id into every log emitted inside an active span. Without those fields in your logs, trace-to-log navigation returns no results.

How Correlation Works

SigNoz links logs to traces through two fields: trace_id and span_id. A log emitted outside any active span carries neither:

{
  "timestamp": "2024-01-15T10:30:00Z",
  "severity": "ERROR",
  "body": "Payment failed",
  "service.name": "payment-service"
}

A log emitted inside an active span carries both. SigNoz uses them to connect that log to the exact span:

{
  "timestamp": "2024-01-15T10:30:00Z",
  "severity": "ERROR",
  "body": "Payment failed",
  "trace_id": "5b8aa5a2d2c872e8321cf37308d69df2",
  "span_id": "051581bf3cb55c13",
  "trace_flags": "01",
  "service.name": "payment-service"
}

The trace_id matches the trace in SigNoz. The span_id identifies which span produced the log.

Automatic Correlation with OpenTelemetry SDK

OpenTelemetry SDKs inject trace_id and span_id into every log emitted during an active span. The setup varies by language.

Install the logging instrumentation package and call .instrument() before your app logs anything:

pip install opentelemetry-instrumentation-logging
from opentelemetry.instrumentation.logging import LoggingInstrumentor

LoggingInstrumentor().instrument(set_logging_format=True)

Calling it patches Python's standard logging module. Logs emitted inside spans carry trace_id and span_id from that point on.

See the instrumentation docs for full per-language setup.

Manual Correlation for File-based and Kubernetes Logs

If logs go to files that a collector reads, or Kubernetes agents collect them from stdout/stderr, use SigNoz Log Pipelines to extract trace context. See the setup guides for FluentBit and FluentD.

Use this path when:

  • Your application writes logs to files read by a collector
  • Kubernetes agents collect logs and they reach SigNoz without OTel SDK injection
  • Logs carry trace IDs in the message body or non-standard attributes

Setting Up Log Pipelines

Follow this guide:

Parse Trace Information for your Logs

It covers:

  1. Creating a log pipeline in SigNoz
  2. Using the Trace Parser processor to extract trace_id and span_id
  3. Configuring regex or JSON parsers when needed
  4. Testing and deploying your pipeline

Verifying Correlation

  1. Generate traffic in your application
  2. Open Traces in SigNoz and click on any trace
  3. Click "Go to related logs"
  4. Check that trace_id and span_id fields appear in the matching log entries
Related logs of a trace in Logs Explorer
Related logs of a trace in Logs Explorer

In Logs Explorer, filter by trace_id to find all logs from a specific trace.

Troubleshooting

Your logs reach SigNoz but lack trace_id. You haven't initialized SDK logging instrumentation, or you called it after creating your loggers. Move .instrument() (Python) or sdk.start() (Node.js) before your first log statement.

trace_id in logs is 00000000000000000000000000000000

This log fired outside an active span. Move logging calls inside instrumented request handlers, not startup code or background goroutines without span context.

Logs have a trace_id but the trace doesn't appear in SigNoz

Sampling dropped the trace. The log exported but the trace did not. Lower your sampling rate or switch to tail-based sampling so SigNoz receives traces with errors.

Go: logs emit but trace_id stays empty

The bridge reads context from the ctx argument, not a global. Every log call must pass the ctx that holds the active span.

Best Practices

  • Prefer OpenTelemetry SDKs over manual pipeline parsing. Auto-injection needs no collector config.
  • Use structured logging (JSON) so pipelines can extract trace_id and span_id
  • Propagate trace context across all services so logs from downstream calls link to the same root trace
  • Add service-level attributes (service.name, host.name) to filter correlated logs when debugging multi-service traces

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.

Last updated: May 12, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.