When you're troubleshooting an issue in your app or host, you need all the New Relic tools at your fingertips. But you don't want to do a lot of context switching across the UI or be overwhelmed by the wealth of information available.
Our APM agents can automatically add relevant attributes to your application log data. This makes using logs in context extremely easy. Applications can also use the agent to forward log data directly to New Relic.
Logs are more valuable in the context of the application, transaction, or error they belong to. Using our logs in context functionality will change the way you troubleshoot by giving you visibility of logs from your applications, distributed traces, and errors directly in APM.
To see how logs in context can help you find the root cause of an issue in your apps and hosts, watch this short video (approx. 3:40 minutes):
Learn more about the power of automatic logs in context. The example describes how an engineering team used it to troubleshoot their app's poor response time and rising error rates.
To set up APM logs in context:
- If you don't have one already, create a New Relic account. It's free, forever.
- Update to the supported agent version for your apps and hosts.
- Enable logs for your agent, and make a few small updates to the configuration file.
That's it! Start troubleshooting your applications with APM logs in context in New Relic:
Drill down into your logs, traces, and errors, all from the APM Summary page in New Relic.
Our latest APM agents support automatically adding context and forwarding logs without the need to install or maintain third-party software! Your logs will automatically include attributes such as
entity.name, and more. This metadata links your logs to traces, spans, infrastructure data, and other telemetry, making it easier to troubleshoot.
Not every language or logging framework is supported yet. The following are our currently supported environments, with links to language-specific documentation:
- Java logs in context procedures for agent v7.6.0 or higher
- .NET logs in context procedures for agent v9.8.0 or higher
- Node.js logs in context procedures for agent v8.11.0 or higher
- Ruby logs in context procedures for agent v8.6.0 or higher
APM logs in context automatically forwards APM agent log data and is enabled by default. This can have a negative impact on your security, compliance, billing, or system performance. For more information, or if you need to adjust the default setting, follow the procedures to disable automatic logging.
If your APM agent doesn't support our automatic logs in context solution yet, you can continue to use our manual logs in context solutions, and forward your logs via our infrastructure agent or supported third-party forwarder.
You control what log data is sent to New Relic, so be sure to follow your organization's security guidelines to mask, obfuscate, or prevent sending personal identifiable information (PII), protected health information (PHI), or any other sensitive data.
Our log ingest pipeline automatically masks credit cards, Social Security numbers, national IDs, etc. For more information, see our security documentation for log management.
You can also create custom rules to mask or hash sensitive data in your logs with our obfuscation feature. This is critical when it is impractical or impossible to restrict access to sensitive data, or when some data should never be stored by New Relic. Read our obfuscation documentation to find out more.
Using logs in context functionality will increase your data ingest. Depending on your account's pricing model, this may have an impact on your ingest limits and billing.
If you want to use the APM agent to send logs directly from your applications, you must disable or modify log forwarding solutions that are currently collecting logs from those applications. Otherwise you will be sending duplicate logs, which will result in double billing.
Check our upgrade guide to learn more about how you can avoid sending duplicate logs.
For more information, follow the procedures to disable your specific log forwarder.
Example: Your engineering team is troubleshooting a problem with your app, so you temporarily increase the volume of logs collected by the APM agent to provide more granular logging. However, if you leave higher limits running for several days, this could lead to sending unnecessary data that will increase your bill.
Here is a detailed use case of using APM logs in context to get to the root cause of a problem.
Example scenario: The on-call engineer receives a New Relic alert notification about poor response time and rising error rates for their app. They need to discover the root cause behind the increase in errors and latency, so they can decide whether to rotate a problematic host out of load balancing or to roll back the most recent release.
To start troubleshooting, they go to the New Relic UI.