Skip to content

Commit 1344dad

Browse files
committed
Add notes to setup guide
1 parent 4a805a3 commit 1344dad

File tree

4 files changed

+101
-13
lines changed

4 files changed

+101
-13
lines changed

docs/tab-widgets/add-dependency.asciidoc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Add a dependency to your application:
1313
</dependency>
1414
----
1515

16-
If you are not using a dependency management tool, like maven, you have to manually add both
16+
NOTE: If you are not using a dependency management tool, like maven, you have to manually add both
1717
`logback-ecs-encoder` and `ecs-logging-core` jars to the classpath.
1818
For example to the `$CATALINA_HOME/lib` directory.
19+
Other than that, there are no required dependencies.
1920
// end::logback[]
2021

2122
// tag::log4j2[]
@@ -33,9 +34,10 @@ Add a dependency to your application:
3334
</dependency>
3435
----
3536

36-
If you are not using a dependency management tool, like maven, you have to manually add both
37+
NOTE: If you are not using a dependency management tool, like maven, you have to manually add both
3738
`log4j2-ecs-layout` and `ecs-logging-core` jars to the classpath.
3839
For example, to the `$CATALINA_HOME/lib` directory.
40+
Other than that, there are no required dependencies.
3941
// end::log4j2[]
4042

4143
// tag::log4j[]
@@ -54,9 +56,10 @@ Add a dependency to your application:
5456
</dependency>
5557
----
5658

57-
If you are not using a dependency management tool, like maven, you have to manually add both
59+
NOTE: If you are not using a dependency management tool, like maven, you have to manually add both
5860
`log4j-ecs-layout` and `ecs-logging-core` jars to the classpath.
5961
For example, to the `$CATALINA_HOME/lib` directory.
62+
Other than that, there are no required dependencies.
6063
// end::log4j[]
6164

6265
// tag::jul[]
@@ -75,9 +78,10 @@ Add a dependency to your application:
7578
</dependency>
7679
----
7780

78-
If you are not using a dependency management tool, like maven, you have to manually add both
81+
NOTE: If you are not using a dependency management tool, like maven, you have to manually add both
7982
`jul-ecs-formatter` and `ecs-logging-core` jars to the classpath.
8083
For example, to the `$CATALINA_HOME/lib` directory.
84+
Other than that, there are no required dependencies.
8185

8286
// end::jul[]
8387

@@ -97,7 +101,7 @@ Add a dependency to your application:
97101
</dependency>
98102
----
99103

100-
If you are not using a dependency management tool, like maven, you have to manually add both
104+
NOTE: If you are not using a dependency management tool, like maven, you have to manually add both
101105
`jboss-logmanager-ecs-formatter` and `ecs-logging-core` jars to the classpath.
102-
106+
Other than that, there are no required dependencies.
103107
// end::jboss[]

docs/tab-widgets/ecs-encoder.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ To include any custom field in the output, use following syntax:
163163

164164
Custom fields are included in the order they are declared. The values support https://logging.apache.org/log4j/2.x/manual/lookups.html[lookups].
165165

166-
167-
166+
NOTE: The log4j2 `EcsLayout` does not allocate any memory (unless the log event contains an `Exception`) to reduce GC pressure.
167+
This is achieved by manually serializing JSON so that no intermediate JSON or map representation of a log event is needed.
168168
// end::log4j2[]
169169

170170
// tag::log4j[]

ecs-logging-core/src/test/java/co/elastic/logging/AbstractEcsLoggingTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ void validateLog(JsonNode logLine) {
9696
validateRequiredField(logLine, specFieldName, specForField.get("required").booleanValue());
9797
if (fieldInLog != null) {
9898
validateIndex(logLine, logFieldNames, specFieldName, specForField.get("index"));
99+
if (specForField.has("nesting_allowed") && !specForField.get("nesting_allowed").asBoolean(true)) {
100+
assertThat(logLine.at(specFieldName)).isNull();
101+
}
99102
validateType(fieldInLog, specForField.get("type").textValue());
100103
}
101104
}

ecs-logging-core/src/test/resources/spec/spec.json

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"type": "string",
1616
"required": true,
1717
"index": 1,
18+
"nesting_allowed": false,
1819
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-log.html"
1920
},
2021
"message": {
@@ -34,14 +35,94 @@
3435
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
3536
"sanitization": {
3637
"key": {
37-
"replacements": [
38-
".",
39-
"*",
40-
"\\"
41-
],
38+
"replacements": [".", "*", "\\"],
4239
"substitute": "_"
4340
}
4441
}
42+
},
43+
"trace.id": {
44+
"type": "string",
45+
"required": false,
46+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
47+
"comment": "When APM agents add this field to the context, ecs loggers should pick it up and add it to the log event."
48+
},
49+
"transaction.id": {
50+
"type": "string",
51+
"required": false,
52+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
53+
"comment": "When APM agents add this field to the context, ecs loggers should pick it up and add it to the log event."
54+
},
55+
"service.name": {
56+
"type": "string",
57+
"required": false,
58+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-service.html",
59+
"comment": [
60+
"Configurable by users.",
61+
"When an APM agent is active, they should auto-configure it if not already set."
62+
]
63+
},
64+
"event.dataset": {
65+
"type": "string",
66+
"required": false,
67+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-event.html",
68+
"default": "${service.name}.log OR ${service.name}.${appender.name}",
69+
"comment": [
70+
"Configurable by users.",
71+
"If the user manually configures the service name,",
72+
"the logging library should set `event.dataset=${service.name}.log` if not explicitly configured otherwise.",
73+
"",
74+
"When agents auto-configure the app to use an ECS logger,",
75+
"they should set `event.dataset=${service.name}.${appender.name}` if the appender name is available in the logging library.",
76+
"Otherwise, agents should also set `event.dataset=${service.name}.log`",
77+
"",
78+
"The field helps to filter for different log streams from the same pod, for example and is required for log anomaly detection."
79+
]
80+
},
81+
"process.thread.name": {
82+
"type": "string",
83+
"required": false,
84+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-process.html"
85+
},
86+
"log.logger": {
87+
"type": "string",
88+
"required": false,
89+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-log.html"
90+
},
91+
"log.origin.file.line": {
92+
"type": "integer",
93+
"required": false,
94+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-log.html",
95+
"comment": "Should be opt-in as it requires the logging library to capture a stack trace for each log event."
96+
},
97+
"log.origin.file.name": {
98+
"type": "string",
99+
"required": false,
100+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-log.html",
101+
"comment": "Should be opt-in as it requires the logging library to capture a stack trace for each log event."
102+
},
103+
"log.origin.function": {
104+
"type": "string",
105+
"required": false,
106+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-log.html",
107+
"comment": "Should be opt-in as it requires the logging library to capture a stack trace for each log event."
108+
},
109+
"error.type": {
110+
"type": "string",
111+
"required": false,
112+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-error.html",
113+
"comment": "The exception type or class, such as `java.lang.IllegalArgumentException`."
114+
},
115+
"error.message": {
116+
"type": "string",
117+
"required": false,
118+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-error.html",
119+
"comment": "The message of the exception."
120+
},
121+
"error.stack_trace": {
122+
"type": "string",
123+
"required": false,
124+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-error.html",
125+
"comment": "The stack trace of the exception as plain text."
45126
}
46127
}
47128
}

0 commit comments

Comments
 (0)