Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Align agents logs documentation #3399

Merged
merged 6 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ include::./api.asciidoc[]

include::./metrics.asciidoc[]

include::./logs.asciidoc[]

include::./api-opentelemetry.asciidoc[]

include::./opentracing.asciidoc[]

include::./log-correlation.asciidoc[]

include::./source-maps.asciidoc[]

include::./distributed-tracing.asciidoc[]
Expand Down
22 changes: 0 additions & 22 deletions docs/log-correlation.asciidoc

This file was deleted.

37 changes: 37 additions & 0 deletions docs/logs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[logs]]
## Logs

Elastic Nodejs Agent provides <<log-correlation-ids>>.
The agent will automaticaly inject correlation IDs that allow navigation between logs, traces and services.

This features is part of {observability-guide}/application-logs.html[Application log ingestion strategies].

The {ecs-logging-nodejs-ref}/intro.html[`ecs-logging-nodejs`] library can also be used to use the {ecs-logging-ref}/intro.html[ECS logging] format without an APM agent.
When deployed with the Nodejs APM agent, the agent will provide <<log-correlation-ids,log correlation>> IDs.

[float]
[[log-correlation-ids]]
== Log correlation

{apm-guide-ref}/log-correlation.html[Log 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 app with transactions captured by the
Elastic APM Node.js Agent, your logs must contain one or more of the following identifiers:

* `transaction.id`
* `trace.id`
* `span.id`

The Node.js Agent provides the `apm.currentTraceIds` method to help with this task.

:leveloffset: -1
include::agent-api.asciidoc[tag=currentTraceIds]
:leveloffset: +1

Using your favorite logging framework, you'd then need to inject this information into your logs.

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
{apm-guide-ref}/log-correlation.html#ingest-logs-in-es[Ingest your logs into Elasticsearch]
for more information.
5 changes: 5 additions & 0 deletions docs/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ This page has moved.

- For details on ES Modules (ESM) support, see <<compatibility-esm>>.
- For information on using the APM agent with TypeScript, see <<typescript>>.

[role="exclude",id="log-correlation"]
=== Log correlation

This section has moved. See <<logs>>.