You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/12/08 13:59:29 UTC

[skywalking] branch master updated: Add instructions for logback with logstash in custom json format (#4019)

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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new bf4d738  Add instructions for logback with logstash in custom json format (#4019)
bf4d738 is described below

commit bf4d738ba9a4c5dcfecf75e70493bf2cac55f426
Author: gonedays <lu...@163.com>
AuthorDate: Sun Dec 8 21:59:20 2019 +0800

    Add instructions for logback with logstash in custom json format (#4019)
    
    Add instructions for logback configuration with logstash, use custom
    json format
---
 .../java-agent/Application-toolkit-logback-1.x.md  | 33 +++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/docs/en/setup/service-agent/java-agent/Application-toolkit-logback-1.x.md b/docs/en/setup/service-agent/java-agent/Application-toolkit-logback-1.x.md
index ea4c830..1e1493b 100644
--- a/docs/en/setup/service-agent/java-agent/Application-toolkit-logback-1.x.md
+++ b/docs/en/setup/service-agent/java-agent/Application-toolkit-logback-1.x.md
@@ -76,4 +76,35 @@
     <provider class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.logstash.TraceIdJsonProvider">
     </provider>
 </encoder>
-```
\ No newline at end of file
+```
+
+* set `LoggingEventCompositeJsonEncoder` of logstash in logback-spring.xml for custom json format
+
+1.add converter for %tid as child of <configuration> node
+```xml
+<!--add converter for %tid -->
+    <conversionRule conversionWord="tid" converterClass="org.apache.skywalking.apm.toolkit.log.logback.v1.x.LogbackPatternConverter"/>
+```
+2.add json encoder for custom json format
+
+```xml
+<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
+            <providers>
+                <timestamp>
+                    <timeZone>UTC</timeZone>
+                </timestamp>
+                <pattern>
+                    <pattern>
+                        {
+                        "level": "%level",
+                        "tid": "%tid",
+                        "thread": "%thread",
+                        "class": "%logger{1.}:%L",
+                        "message": "%message",
+                        "stackTrace": "%exception{10}"
+                        }
+                    </pattern>
+                </pattern>
+            </providers>
+</encoder>
+```