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:10 UTC

[logging-log4j2] branch master updated (bdc12dc -> e5ab9f8)

This is an automated email from the ASF dual-hosted git repository.

vy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from bdc12dc  LOG4J2-2828 Preserve file permissions after rollover in RollingRandomAccessFileAppender. (#364)
     new 5a5f628  #335 Update ECS layout compatibility after feedback from Felix Barny.
     new e5ab9f8  #335 Update manual after feedback from Maurice Zeijen.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/resources/EcsLayout.json              |  4 +---
 .../log4j/layout/json/template/EcsLayoutTest.java  |  9 +++++++-
 pom.xml                                            |  2 +-
 src/site/asciidoc/manual/json-template-layout.adoc | 27 +++++++++++-----------
 4 files changed, 24 insertions(+), 18 deletions(-)


[logging-log4j2] 02/02: #335 Update manual after feedback from Maurice Zeijen.

Posted by vy...@apache.org.
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 e5ab9f8d38968215e78d2eba51f6697746023545
Author: Volkan Yazıcı <vo...@gmail.com>
AuthorDate: Thu Jun 18 16:56:38 2020 +0200

    #335 Update manual after feedback from Maurice Zeijen.
---
 src/site/asciidoc/manual/json-template-layout.adoc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/site/asciidoc/manual/json-template-layout.adoc b/src/site/asciidoc/manual/json-template-layout.adoc
index 1faf985..f3e22db 100644
--- a/src/site/asciidoc/manual/json-template-layout.adoc
+++ b/src/site/asciidoc/manual/json-template-layout.adoc
@@ -186,7 +186,7 @@ appender.console.json.eventTemplateUri = classpath:LogstashJsonEventLayoutV1.jso
   property)
 
 | eventTemplateAdditionalFields
-| KeyValuePair[]
+| EventTemplateAdditionalField[]
 | additional key-value pairs appended to the root of the event template
 
 | stackTraceElementTemplate
@@ -227,15 +227,18 @@ appender.console.json.eventTemplateUri = classpath:LogstashJsonEventLayoutV1.jso
 [#additional-event-template-fields]
 === Additonal event template fields
 
-One can configure additional event template fields via
-`eventTemplateAdditionalFields` as follows:
+Additional event template field is a convenient short-cut to add custom fields
+to a template or override the fields of a template. Following configuration
+overrides the `host` field of the `GelfLayout.json` template and adds two new
+custom fields:
 
 [source,xml]
 ----
-<JsonTemplateLayout ...>
+<JsonTemplateLayout eventTemplateUri="classpath:GelfLayout.json">
     <EventTemplateAdditionalFields>
-        <EventTemplateAdditionalField key="serviceName" value="auth-service"/>
-        <EventTemplateAdditionalField key="containerId" value="6ede3f0ca7d9"/>
+        <EventTemplateAdditionalField key="host" value="www.apache.org"/>
+        <EventTemplateAdditionalField key="_serviceName" value="auth-service"/>
+        <EventTemplateAdditionalField key="_containerId" value="6ede3f0ca7d9"/>
     </EventTemplateAdditionalFields>
 </JsonTemplateLayout>
 ----


[logging-log4j2] 01/02: #335 Update ECS layout compatibility after feedback from Felix Barny.

Posted by vy...@apache.org.
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": {