• /
  • Log in
  • Free account

Configure logs in context with APM agents

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.


To use logs in context and log management, as well as the rest of our observability platform, join the New Relic family! Sign up to create your free account in only a few seconds. Then ingest up to 100GB of data for free each month. Forever.

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 you 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:

New Relic logs in context diagram

This diagram illustrates the flow of log messages through New Relic.

Compatibility and requirements

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

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:


Supported logging framework


  • n/a

Go agent

  • logrus 1.4 or higher

Java agent

  • Dropwizard 1.3 or higher
  • Log4j 1.x
  • Log4j 2.x
  • Logback
  • java.util.logging

.NET agent

  • log4net
  • NLog
  • Serilog

Node.js agent

  • Winston

PHP agent

  • Monolog

Python agent

  • Python logging

Ruby agent

  • Ruby logger

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:

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.