Enable logs-in-context with APM agents

BETA

Combined with New Relic Logs, logs-in-context makes it easy 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 then automatically filtering to these logs from the errors or distributed trace UIs. Bringing all of this data together in a single tool allows a user to quickly get to the root cause of an issue -- narrowing down from all of your logs, to finding the exact 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

APM logs-in-context (linking logs directly to Applications, APM errors, and APM traces and spans) for New Relic Logs is currently available as a beta feature. Your use of the early access service is at your own risk. New Relic disclaims all warranties, express or implied, regarding the beta services.

Compatibility and requirements

Access to APM logs-in-context requires a New Relic APM Pro subscription and enabling of distributed tracing. Before enabling distributed tracing, read the transition guide to learn about the effects on existing APM features and set-up recommendations.

To enable APM logs-in-context for New Relic Logs, ensure your configuration meets the following requirements:

Enable APM logs-in-context for New Relic Logs

Before enabling logs-in-context, you must have the appropriate feature flags. To be added, please contact rholzschuh@newrelic.com.

Before you get started, here is an overview of the steps to enable APM logs-in-context:

  1. Confirm that you have New Relic Logs enabled, with a compatible logging tool installed to send your application logs to New Relic.
  2. Install or update your APM agent, including enabling Distributed Tracing, as needed.
  3. Install a logging extension to annotate your application log files with logs-in-context metadata.
  4. Configure your logging to use the extension or plug-in.
  5. Confirm that it is working by following the guidance for your agent language, but in general:​
    • when you view your logs, you can see logs-in-context metadata, and then,
    • you can view this metadata using the New Relic Logs UI.

Choose your APM agent to see specific instructions on how to enable APM logs-in-context for your agent language:

Agent Supported logging framework
Go agent
  • logrus 1.4 or higher

Java agent

  • Dropwizard 1.3 or higher
  • Log4j 1.x
  • Log4j 2.x
  • Logback
  • java.util.logging
Ruby agent
  • Ruby logger
PHP agent (coming soon)
.Net agent (coming soon)
Python agent (coming soon)
Node.js agent (coming soon)

What's next?

Once you've enabled APM logs-in-context, here are some potential next steps:

For more help

Recommendations for learning more: