Logs in context makes it easy to link to your log data with related data across the rest of the New Relic platform. For example, you can easily correlate log messages to a related error trace or distributed trace in APM. This is accomplished by appending trace IDs to the corresponding application logs, automatically filtering to those logs from the errors or distributed trace UIs.
Why it matters
Bringing all of this data together in a single tool allows you to quickly get to the root cause of an issue and find the log lines that you need to identify and resolve a problem.
New Relic’s logs in context feature gives users the ability to see logs associated with various objects in the New Relic UI:
- Applications
- APM errors
- APM traces and spans
- Kubernetes containers
The following diagram shows the lifecycle of a log message, from enrichment with agent metadata (contextual logging), to formatting and forwarding the log data to New Relic:

Compatibility and requirements
To configure APM logs in context for New Relic, ensure your configuration meets the following requirements:
- New Relic logs management enabled, with a compatible log forwarding plugin installed.
- Ability to update to a supported version of the APM agent, and ability to enable distributed tracing for your agent:
- Go agent version 2.12 or higher
- Java agent version 5.6 or higher
- .NET agent version 8.21 or higher
- Node.js agent version 6.2.0 or higher
- PHP agent version 9.3.0 or higher
- Python agent version 5.4.0 or higher
- Ruby agent version 6.7.0 or higher
Configure APM logs in context for New Relic
Choose your APM agent to see specific instructions on how to configure APM logs in context for your agent language:
Agent | Supported logging framework |
---|---|
Go agent |
|
|
|
.NET agent |
|
Node.js agent |
|
PHP agent |
|
Python agent |
|
Ruby agent |
|
For information on creating your own logging extension, see logs in context API calls.
What's next?
Now that you've set up APM logs in context, here are some potential next steps:
- Explore your data using the Logs UI.
- Troubleshoot errors with distributed tracing, stack traces, application logs, and more.
- Query your data and create custom dashboards or alerts.