我用的logstash-logback-encoder
是6.3。我想在 Kibana 中编写结构化参数。我的代码:
Map<String, String> extractHeaders = ...
log.debug(Markers.append("http", Map.of("url", request.getUrl(), "headers", extractHeaders)),"Some message");
在 Kibana 中,我看到了这一点:
但为什么?为什么 Kibana 扁平化 json 键?我期待这样的观点:
"fields": {
....
"http": {
"headers": {
"X-Auth-Token": "ew0KICAiY2xpZW50SWQiIDog",
.....
},
"url": "some url"
}
....
}
如何放置嵌套对象?
我的 logback.xml:
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>${logstashHost}:${logstashPort}</destination>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<provider class="net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider" />
</encoder>
</appender>