how to set the case of skywalking java agent+ logstash-logback in async mode #13788
Replies: 1 comment
-
Use the AI we provided on the website. Here is the clear answer from it.This is a known issue with SkyWalking and async appenders. The core problem is that when using The Recommended SolutionDon't use For your specific case with A confirmed working configuration from the community is: <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>${logging.logstash}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<provider class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.logstash.TraceIdJsonProvider"/>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
<pattern>
<pattern>
{
"level": "%level",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{1.}:%L",
"message": "%message",
"stackTrace": "%exception{10}"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="logstash"/>
</root>Note that If You Must Use AsyncAppender (for console/file appenders)For standard console or file appenders, SkyWalking does support <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n</Pattern>
</layout>
</encoder>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>1024</queueSize>
<neverBlock>true</neverBlock>
<appender-ref ref="STDOUT"/>
</appender>However, this MDC approach is not directly applicable to your |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have tried various asynchronous configurations, but all failed without exception, resulting in the loss of tid. Only the synchronous method below can properly push tid. If switching to asynchronous, how should it be configured, and are there any reference cases available?
Beta Was this translation helpful? Give feedback.
All reactions