How It Works
To link traces with logs, you need to add the same identifier to both, such asrequest_id or trace_id.
This will be set up automatically in most cases, but when it’s not make sure the following identifiers are set.
- Add a request or trace identifier to your trace as an AppSignal tag or OpenTelemetry attribute.
- Add the same identifier to your logs as a log attribute.
Choosing an Identifier
You can use any of the following identifiers to link traces and logs:request_id- A unique identifier for each HTTP request (common in web frameworks).trace_id- The AppSignal or OpenTelemetry trace ID.
request_id for each request, making it a convenient choice.
For OpenTelemetry-based integrations, you can use the trace ID directly.
Linking Application Logs
Report logs from your application by setting up logging using the AppSignal packages or OpenTelemetry SDK. Most framework configuration will already haverequest_id or trace_id tags set up.
If no relevant logs are detected, follow the logging set up instructions for the framework your application uses or report the identifier manually as a trace tag and log attribute.
Viewing Linked Logs
Once you’ve configured your application to link traces with logs, you can view related logs directly in the AppSignal interface:- Navigate to a performance trace sample or error incident.
- Look for the related logs block, which will link to the relevant log messages.
- Use the logs to gain additional context about what happened during the request.
Next Steps
- Set up log reporting to send your application logs to AppSignal.
- Learn more about adding tags to your traces.