Skip to content

Commit 6afbf05

Browse files
SylvainJugebasepi
andauthored
[doc] Align agents logs documentation (#1837)
* change logs structure * update content * add ecs logging link * fix link to config option for reformatting * make doc fit the implementation --------- Co-authored-by: Colton Myers <colton@basepi.net>
1 parent d51e72a commit 6afbf05

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

docs/logging.asciidoc

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
[[log-correlation]]
2-
== Log correlation
1+
[[logs]]
2+
== Logs
33

4-
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.
4+
Elastic Python APM Agent provides the following log features:
55

6-
The Agent provides integrations with both the default Python logging library,
7-
as well as http://www.structlog.org/en/stable/[`structlog`].
6+
- <<log-correlation-ids>> : Automatically inject correlation IDs that allow navigation between logs, traces and services.
7+
- <<log-reformatting>> : Automatically reformat plaintext logs in {ecs-logging-ref}/intro.html[ECS logging] format.
88

9-
* <<logging-integrations>>
10-
* <<log-correlation-in-es>>
9+
Those features are part of {observability-guide}/application-logs.html[Application log ingestion strategies].
10+
11+
The {ecs-logging-python-ref}/intro.html[`ecs-logging-python`] library can also be used to use the {ecs-logging-ref}/intro.html[ECS logging] format without an APM agent.
12+
When deployed with the Python APM agent, the agent will provide <<log-correlation-ids,log correlation>> IDs.
1113

1214
[float]
13-
[[ecs-logging]]
14-
=== `ecs-logging`
15+
[[log-correlation-ids]]
16+
=== Log correlation
1517

16-
The easiest way to integrate your logs with APM is to use the
17-
https://github.com/elastic/ecs-logging-python[`ecs-logging`] library, which
18-
is also provided by Elastic. This library provides formatters for both `logging`
19-
and `structlog` which create ECS-compatible logs and will include the tracing
20-
information required for log correlation in kibana. Coupled with something like
21-
https://www.elastic.co/beats/filebeat[Filebeat], it is the easiest way to get
22-
logs into Elasticsearch.
18+
{apm-guide-ref}/log-correlation.html[Log correlation] allows you to navigate to all logs belonging to a particular trace
19+
and vice-versa: for a specific log, see in which context it has been logged and which parameters the user provided.
2320

21+
The Agent provides integrations with both the default Python logging library,
22+
as well as http://www.structlog.org/en/stable/[`structlog`].
23+
24+
* <<logging-integrations>>
25+
* <<log-correlation-in-es>>
2426

2527
[float]
2628
[[logging-integrations]]
27-
=== Logging integrations
29+
==== Logging integrations
2830

2931
[float]
3032
[[logging]]
31-
==== `logging`
33+
===== `logging`
3234

3335
For Python 3.2+, we use https://docs.python.org/3/library/logging.html#logging.setLogRecordFactory[`logging.setLogRecordFactory()`]
3436
to decorate the default LogRecordFactory to automatically add new attributes to
@@ -66,7 +68,7 @@ your log handlers, as handlers are propagated, along with their attached filters
6668

6769
[float]
6870
[[structlog]]
69-
==== `structlog`
71+
===== `structlog`
7072

7173
We provide a http://www.structlog.org/en/stable/processors.html[processor] for
7274
http://www.structlog.org/en/stable/[`structlog`] which will add three new keys
@@ -174,3 +176,13 @@ Then, you could use a grok pattern like this (for the
174176
]
175177
}
176178
----
179+
180+
[float]
181+
[[log-reformatting]]
182+
=== Log reformatting (experimental)
183+
184+
The agent can automatically reformat application to ECS format when the application includes the `ecs-logging-python` library in its dependencies.
185+
186+
Log reformatting is controlled by the <<config-log_ecs_reformatting, `log_ecs_reformatting`>> configuration option, and is disabled by default.
187+
188+
The reformatted logs will include both the <<log-correlation-ids, trace and service correlation>> IDs.

docs/redirects.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ The following pages have moved or been deleted.
77
=== OpenTracing API
88

99
Refer to <<opentelemetry-bridge>> instead.
10+
11+
[role="exclude",id="log-correlation"]
12+
=== Log correlation
13+
14+
Refer to <<logs>> instead.

0 commit comments

Comments
 (0)