For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/logs/log_configuration/processors/span_remapper.md. A documentation index is available at /llms.txt.

Overview

There are two ways to define correlation between application spans and logs:

  1. Follow the documentation on how to inject a Span ID in the application logs. Log integrations automatically handle all remaining setup steps by default.

  2. Use the span remapper processor to define a log attribute as its associated span ID.

Use cases

The Span Remapper is typically used to select the Span Id that is within a log message that needs first to be parsed with a Grok Parser.

API

Use the Datadog Log Pipeline API endpoint with the following span remapper JSON payload:

{
  "type": "span-id-remapper",
  "name": "Define dd.span_id as the official span id associated with this log",
  "is_enabled": true,
  "sources": ["dd.span_id"]
}
ParameterTypeRequiredDescription
typeStringYesType of the processor.
nameStringNoName of the processor.
is_enabledBooleanNoIndicates whether the processor is enabled. Default: false.
sourcesArray of stringsNoArray of source attributes. Default: dd.span_id.

Note: Trace IDs and span IDs are not displayed in your logs or log attributes in the UI.

Further reading

Additional helpful documentation, links, and articles: