To correlate log data with other telemetry data, such as errors and distributed traces in APM, you can use our logs in context solutions. If your logging framework is not available with our existing logs in context solutions, you can configure your logging libraries by using API calls to annotate your logs.
APM agent trace metadata and linking metadata APIs
To get properly annotated logs for logs in context, use the following API calls for your APM agent. These APIs pass the required trace metadata and linking metadata to link your log data to other New Relic data.
APM agent APIs:
APM agent | API calls |
---|---|
See our Log API documentation. | |
Go | |
Java | |
.NET | |
Node.js | |
PHP | |
Python | |
Ruby |
Resources for correctly annotating logs
For more information about using the trace metadata and linking metadata APIs to annotate logs for logs in context, review the APM agent specifications in GitHub. These specifications include the required fields and properly formatted output.
Also, review the source code for our own logs in context extensions to see how we use these APIs:
- C SDK: n/a
- Go: Logrus extension
- Java: Log4j2 extension
- .NET: Serilog extension
- Node.js: Winston extension
- Python: Streamhandler example
- PHP: Monolog extension
- Ruby: logging.rb extension
その他のヘルプ
さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:
- Explorers Hubでは、コミュニティからのサポートを受けたり、ディスカッションに参加したりすることができます。
- 当社サイトで答えを見つけて、サポートポータルの使用方法を確認してください。
- Linux、Windows、およびmacOS向けトラブルシューティングツールであるNew Relic Diagnosticsを実行してください。
- New Relicの とandドキュメント をご確認ください。