- APM Node.js Agent: other versions:
- Introduction
- Set up the Agent
- Monitoring AWS Lambda Node.js Functions
- Monitoring Node.js Azure Functions
- Get started with Express
- Get started with Fastify
- Get started with hapi
- Get started with Koa
- Get started with Next.js
- Get started with Restify
- Get started with TypeScript
- Get started with a custom Node.js stack
- Starting the agent
- Supported technologies
- Configuration
- API Reference
- Metrics
- Logs
- OpenTelemetry bridge
- OpenTracing bridge
- Source map support
- ECMAScript module support
- Distributed tracing
- Message queues
- Performance Tuning
- Troubleshooting
- Upgrading
- Release notes
Logs
editLogs
editThe Elastic APM Node.js Agent provides support for Log correlation. When
used together with the ecs-logging-nodejs
packages, correlation IDs will be automatically injected into log records to
allow navigation between logs, traces, and services.
This feature is part of Application log ingestion strategies.
Log correlation
editLog correlation allows you to navigate to all logs belonging to a particular trace and vice-versa: for a specific log, see in which context it has been logged and which parameters the user provided.
In order to correlate logs from your application with traces captured by the Elastic APM Node.js Agent, your logs must contain the following identifiers:
The APM Node.js Agent provides the apm.currentTraceIds
API for this.
If your application is also using one of the ECS formatting plugin packages
(available for Pino, Winston, and Morgan), then this APM Agent API will
automatically be used to inject the appropriate tracing fields into your log
records. Otherwise, configure your logger to add these fields when emitting a
log record.
When your logs contain the appropriate identifiers, the final step is to ingest them into the same Elasticsearch instance that contains your APM data. See Ingest your logs into Elasticsearch for more information.
On this page