When you need to correlate log data with other telemetry data, enable logs in context in New Relic. Logs in context adds metadata that links your logs with related APM data, like errors or distributed traces, or your platform performance data from infrastructure monitoring in New Relic One.
See the root cause of issues across your platform
By bringing all of your application and infrastructure data together in a single solution, you can get to the root cause of issues faster. Logs in context help you quickly see meaningful patterns and trends.
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:
This diagram illustrates the flow of log messages through New Relic.
Don't spend extra time trying to narrow down all your logs from different parts of your platform. Instead, enable logs in context to see the exact log lines you need to identify and resolve a problem.
Basic process to enable logs in context
The process to enable logs in context is basically the same, regardless of which APM agent you use to monitor your application:
- Make sure you have already set up logging in New Relic. This includes configuring a supported log forwarder that collects your application logs and extends the metadata that is forwarded to New Relic.
- Update to a supported APM agent version for your app, and enable distributed tracing.
- Configure logs in context for your APM agent or for your infrastructure monitoring agent.
- View your logs within the context of your apps or infrastructure in New Relic One.
The main differences in this procedure are which log appenders you can use to extend and enrich your log data, and how to configure the log appender you select for your APM agent.
For detailed information, see the logs-in-context procedures for:
API and other options
If our logging solutions don't meet your needs, you can use other options to send your log data to New Relic:
- Logging extensions via agent API calls
- HTTP endpoint via our Log API
- Syslog protocols via TCP endpoint (useful for CDNs, hardware devices, or managed services)
What's next?
After you set up APM logs in context, make the most of your logging data:
- Explore the logging data across your platform with our Logs UI.
- See your logs in context of your app's performance in the APM UI. Troubleshoot errors with distributed tracing, stack traces, application logs, and more.
- Get deeper visibility into both your application and your platform performance data by forwarding your logs with our infrastructure monitoring agent. Review your infrastructure logs in the UI.
- Set up alerts.
- Query your data and create dashboards.
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.