Dynamo provides structured logging in both text as well as JSONL. When
JSONL is enabled logs additionally contain span creation and exit
events as well as support for trace_id and span_id fields for
distributed tracing.
For collecting and visualizing logs with Grafana Loki (Kubernetes), or viewing trace context in logs alongside Grafana Tempo, start the observability stack. See Observability Getting Started for instructions.
Enable structured JSONL logging:
Logs will be written to stderr in JSONL format with trace context.
Environment Setting:
Resulting Log format:
Environment Setting:
Resulting Log format:
When DYN_LOGGING_JSONL is enabled, all logs include trace_id and span_id fields, and spans are automatically created for requests. This is useful for short debugging sessions where you want to examine trace context in logs without setting up a full tracing backend and for correlating log messages with traces.
The trace and span information uses the OpenTelemetry format and libraries, which means the IDs are compatible with OpenTelemetry-based tracing backends like Tempo or Jaeger if you later choose to enable trace export.
This section has overlap with Distributed Tracing with Tempo. For trace visualization in Grafana Tempo and persistent trace analysis, see Distributed Tracing with Tempo.
To see trace information in logs:
This enables JSONL logging with trace_id and span_id fields. Traces appear in logs but are not exported to any backend.
Send a request to generate logs with trace context:
Check the logs (stderr) for JSONL output containing trace_id, span_id, and x_request_id fields.
This section shows how trace and span information appears in JSONL logs. These logs can be used to understand request flows even without a trace visualization backend.
When viewing the corresponding trace in Grafana, you should be able to see something like the following:

http-requesthandle_payloadhandle_payloadThe following shows the JSONL logs from the frontend service for the same request. Note the trace_id field (b672ccf48683b392891c5cb4163d4b51) that correlates all logs for this request, and the span_id field that identifies individual operations:
You can provide a custom request ID using the x-request-id header. This ID will be attached to all spans and logs for that request, making it easier to correlate traces with application-level request tracking.
All spans and logs for this request will include the x_request_id attribute with value 8372eac7-5f43-4d76-beca-0a94cfb311d0.
Notice how the x_request_id field appears in all log entries, alongside the trace_id (80196f3e3a6fdf06d23bb9ada3788518) and span_id: