You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2020/06/18 14:57:11 UTC
[logging-log4j2] 01/02: #335 Update ECS layout compatibility after
feedback from Felix Barny.
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 5a5f6280b56ed3cd67c9e9ed91be56b0951eaf28
Author: Volkan Yazıcı <vo...@gmail.com>
AuthorDate: Thu Jun 18 16:55:47 2020 +0200
#335 Update ECS layout compatibility after feedback from Felix Barny.
---
log4j-layout-json-template/src/main/resources/EcsLayout.json | 4 +---
.../logging/log4j/layout/json/template/EcsLayoutTest.java | 9 ++++++++-
pom.xml | 2 +-
src/site/asciidoc/manual/json-template-layout.adoc | 12 +++++-------
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/log4j-layout-json-template/src/main/resources/EcsLayout.json b/log4j-layout-json-template/src/main/resources/EcsLayout.json
index f5f957b..dee7a84 100644
--- a/log4j-layout-json-template/src/main/resources/EcsLayout.json
+++ b/log4j-layout-json-template/src/main/resources/EcsLayout.json
@@ -24,9 +24,7 @@
},
"labels": {
"$resolver": "mdc",
- "flatten": {
- "prefix": "labels."
- },
+ "flatten": true,
"stringified": true
},
"tags": {
diff --git a/log4j-layout-json-template/src/test/java/org/apache/logging/log4j/layout/json/template/EcsLayoutTest.java b/log4j-layout-json-template/src/test/java/org/apache/logging/log4j/layout/json/template/EcsLayoutTest.java
index 262ddb1..d6cbd30 100644
--- a/log4j-layout-json-template/src/test/java/org/apache/logging/log4j/layout/json/template/EcsLayoutTest.java
+++ b/log4j-layout-json-template/src/test/java/org/apache/logging/log4j/layout/json/template/EcsLayoutTest.java
@@ -4,7 +4,6 @@ import co.elastic.logging.log4j2.EcsLayout;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.DefaultConfiguration;
-import org.apache.logging.log4j.core.util.KeyValuePair;
import org.apache.logging.log4j.layout.json.template.JsonTemplateLayout.EventTemplateAdditionalField;
import org.assertj.core.api.Assertions;
import org.junit.Test;
@@ -21,6 +20,8 @@ public class EcsLayoutTest {
private static final String SERVICE_NAME = "test";
+ private static final String EVENT_DATASET = "test.log";
+
private static final JsonTemplateLayout JSON_TEMPLATE_LAYOUT = JsonTemplateLayout
.newBuilder()
.setConfiguration(CONFIGURATION)
@@ -35,6 +36,11 @@ public class EcsLayoutTest {
.newBuilder()
.setKey("service.name")
.setValue(SERVICE_NAME)
+ .build(),
+ EventTemplateAdditionalField
+ .newBuilder()
+ .setKey("event.dataset")
+ .setValue(EVENT_DATASET)
.build()
})
.build())
@@ -44,6 +50,7 @@ public class EcsLayoutTest {
.newBuilder()
.setConfiguration(CONFIGURATION)
.setServiceName(SERVICE_NAME)
+ .setEventDataset(EVENT_DATASET)
.build();
@Test
diff --git a/pom.xml b/pom.xml
index 2c645f4..82ba4c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -835,7 +835,7 @@
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>log4j2-ecs-layout</artifactId>
- <version>0.1.3</version>
+ <version>0.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
diff --git a/src/site/asciidoc/manual/json-template-layout.adoc b/src/site/asciidoc/manual/json-template-layout.adoc
index db4bdcd..1faf985 100644
--- a/src/site/asciidoc/manual/json-template-layout.adoc
+++ b/src/site/asciidoc/manual/json-template-layout.adoc
@@ -270,10 +270,10 @@ prefer one over another is explained below:
new instance. This will obviously create a load on the garbage-collector. It
is a good choice for applications with low and medium log rate.
-* `threadLocal` performs the best, since every instance is stored in TLAB and
-accessed without any synchronization cost. Though this might not be a
-desirable option for applications running with hundreds of threads or more,
-e.g., a web servlet.
+* `threadLocal` performs the best, since every instance is stored in
+``ThreadLocal``s and accessed without any synchronization cost. Though this
+might not be a desirable option for applications running with hundreds of
+threads or more, e.g., a web servlet.
* `queue` is the best of both worlds. It allows recycling of objects up to a
certain number (`capacity`). When this limit is exceeded due to excessive
@@ -343,9 +343,7 @@ artifact:
},
"labels": {
"$resolver": "mdc",
- "flatten": {
- "prefix": "labels."
- },
+ "flatten": true,
"stringified": true
},
"tags": {