怎么配置logback加标签,让datadog能识别出源?
我有以下内容logback.xml
:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>
<configuration>
<springProperty scope="local" name="DATADOG_API_KEY" source="datadog.api-key" />
<appender name="datadog" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>intake.logs.datadoghq.com:10514</destination>
<keepAliveDuration>1 minute</keepAliveDuration>
<includeCallerData>true</includeCallerData>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<includeCallerData>true</includeCallerData>
<includeTags>true</includeTags>
<customFields>{"ddtags": "source:java"}</customFields>
<prefix class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>${DATADOG_API_KEY} %mdc{weJustNeedSthEmptyHereSoTheXMLParserWillKeepAWhitespace}</pattern>
</layout>
</prefix>
</encoder>
</appender>
<root>
<appender-ref ref="datadog"/>
</root>
</configuration
自定义字段ddtags
应该为 datadog 设置标签的位置。
日志显示在 datadog 中,并且一切都按预期工作,尽管有source
-tag。从我的服务发送的日志消息在 datadog:source:java
和中显示有两个标签source:undefined
:
如何摆脱source:undefined
标签以便 datadog 正确识别来源?