Closed HuangDayu closed 4 years ago
Duplicate of #3713
Are you using version <8.1.0?
解决了
<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",
"serviceName": "${spring.application.name:-}",
"serviceId": "${spring.application.instance-id:-}",
"pid": "${PID:-}",
"tid": "%tid",
"thread": "%thread",
"class": "%logger{1.}:%L",
"message": "%message",
"stackTrace": "%exception{10}"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<appender-ref ref="logstash"/>
</appender>
my logback-spring.xml file
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:4560</destination>
<reconnectionDelay>1 second</reconnectionDelay>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
<provider class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.logstash.TraceIdJsonProvider">
</provider>
<customFields>{"app":"server"}</customFields>
</encoder>
</appender>
zh_CN:
你好,我的配置如下,控制台的tid是有值,但是logstash 日志的tid值是获取不到的,不知是什么原因,请帮忙看一下,谢谢。
en_US:
Hello, my configuration is as follows. The tid of the console has a value, but the pid value of the logstash log is not available. I don't know the reason. Please help to take a look. Thank you.