You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7,185 +7,23 @@ Centralized logging for Java applications with the Elastic stack made easy
7
7
8
8
---
9
9
10
-
**Please note**that this library is in a **beta** version and backwards-incompatible changes might be introduced in future releases while the major version is zero (0.x.x).
10
+
**Please note**This library is in **beta**. Backward-incompatible changes might be introduced in future releases while the major version is zero (0.x.x).
To get notified about new releases, watch this repository for `Releases only`.
17
17
18
-
Elastic Common Schema (ECS) defines a common set of fields for ingesting data into Elasticsearch.
19
-
For more information about ECS, visit the [ECS Reference Documentation](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html).
18
+
## Getting Help
20
19
21
-
## What is ECS logging?
20
+
If you need help or hit an issue, please start by opening a topic on our [discuss forums](https://discuss.elastic.co/c/observability/logs/69).
21
+
Please note that we reserve GitHub tickets for confirmed bugs and enhancement requests.
22
22
23
-
This library helps to log ECS-compatible JSON into a file
23
+
## Documentation
24
24
25
-
Example:
26
-
```
27
-
{"@timestamp":"2019-08-06T12:09:12.375Z", "log.level": "INFO", "message":"Tomcat started on port(s): 8080 (http) with context path ''", "service.name":"spring-petclinic","process.thread.name":"restartedMain","log.logger":"org.springframework.boot.web.embedded.tomcat.TomcatWebServer"}
28
-
{"@timestamp":"2019-08-06T12:09:12.379Z", "log.level": "INFO", "message":"Started PetClinicApplication in 7.095 seconds (JVM running for 9.082)", "service.name":"spring-petclinic","process.thread.name":"restartedMain","log.logger":"org.springframework.samples.petclinic.PetClinicApplication"}
{"@timestamp":"2019-09-17T13:16:48.038Z", "log.level":"ERROR", "message":"Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Expected: controller used to showcase what happens when an exception is thrown] with root cause", "process.thread.name":"http-nio-8080-exec-1","log.logger":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]","log.origin":{"file.name":"DirectJDKLog.java","function":"log","file.line":175},"error.type":"java.lang.RuntimeException","error.message":"Expected: controller used to showcase what happens when an exception is thrown","error.stack_trace":[
31
-
"java.lang.RuntimeException: Expected: controller used to showcase what happens when an exception is thrown",
Docs are located on [elastic.co](https://www.elastic.co/guide/en/ecs-logging/java/current/index.html).
40
26
41
-
## Why ECS logging?
27
+
## License
42
28
43
-
* No parsing of the log file required \
44
-
Logging in ECS-compatible JSON has the advantage that you don't need to set up a logstash/ingest node pipeline to parse logs using grok.
45
-
* No external dependencies
46
-
* Highly efficient by manually serializing JSON
47
-
* Low/Zero allocations (reduces GC pauses) \
48
-
The log4j2 `EcsLayout` does not allocate any memory (unless the log event contains an `Exception`)
49
-
* Decently human-readable JSON structure \
50
-
The first three fields are always `@timestamp`, `log.level` and `message`.
51
-
It's also possible to format stack traces so that each element is rendered in a new line.
52
-
* Use the Kibana [Logs UI](https://www.elastic.co/guide/en/kibana/7.3/xpack-logs.html) without additional configuration \
53
-
As this library adheres to [ECS](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html), the Logs UI knows which fields to show
54
-
* Using a common schema across different services and teams makes it possible create reusable dashboards and avoids [mapping explosions](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html#mapping-limit-settings).
55
-
56
-
### APM Log correlation
57
-
58
-
If you are using the [Elastic APM Java agent](https://www.elastic.co/guide/en/apm/agent/java/current/index.html),
59
-
you can leverage the [log correlation feature](https://www.elastic.co/guide/en/apm/agent/java/current/config-logging.html#config-enable-log-correlation) without any additional configuration.
60
-
61
-
This lets you jump from the [Span timeline in the APM UI](https://www.elastic.co/guide/en/kibana/master/spans.html) to the
|Each MDC entry is a top-level field <ahref="#note1"id="note1ref"><sup>1</sup></a>|[`LogEvent#getContextMap()`](https://logging.apache.org/log4j/log4j-2.3/log4j-core/apidocs/org/apache/logging/log4j/core/LogEvent.html#getContextMap())|
<aid="note1"href="#note1ref"><sup>1</sup></a> It's recommended to use existing [ECS fields](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html) for MDC values.
102
-
103
-
If there is no appropriate ECS field,
104
-
consider prefixing your fields with `labels.`, as in `labels.foo`, for simple key/value pairs.
105
-
For nested structures consider prefixing with `custom.` to make sure you won't get conflicts if ECS later adds the same fields but with a different mapping.
106
-
107
-
108
-
## Getting Started
109
-
110
-
### Step 1: Configure application logging
111
-
112
-
-[Logback](logback-ecs-encoder/README.md) (default for Spring Boot)
0 commit comments