log-pilot icon indicating copy to clipboard operation
log-pilot copied to clipboard

解析console输出json格式字符串的问题

Open disidle opened this issue 4 years ago • 2 comments

springboot项目,使用net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder 进行日志格式化输出至控制台 <timeZone>UTC</timeZone> { "severity": "%level", "service": "${springAppName:-}", "trace": "%X{X-B3-TraceId:-}", "span": "%X{X-B3-SpanId:-}", "parent": "%X{X-B3-ParentSpanId:-}", "exportable": "%X{X-Span-Export:-}", "pid": "${PID:-}", "thread": "%thread", "class": "%logger{40}", "message": "%message", "stack_trace": "%rootException{5}" }

log-pilot版本为:registry.cn-hangzhou.aliyuncs.com/acs/log-pilot:0.9.7-fluentd docker-compose中指定 aliyun.logs.cloudpen.format=json 标签 期望输出至elasticsearch, 自动拆解程序模块console输出的json格式日志,但es中记录的是没有拆解过的整串json文本。 这不符合预期啊 这个项目很久没更新了,是否还有人在支撑维护?

另外fluentd 版本和filebeat版本有什么区别,能解答一下吗

谢谢!

disidle avatar Aug 24 '20 11:08 disidle

同样的问题。 看了log-pilot生成的fluentd配置文件,并没有把 json日志中的log字段设置为root key。

<source>
  @type tail
  tag docker.a1c54fef9b8dc2ea9294a6ed66a37da8223b94bc6a6054e9bd84f3f48e0c3cb0.istio-app-log3
  path /host/var/lib/docker/containers/a1c54fef9b8dc2ea9294a6ed66a37da8223b94bc6a6054e9bd84f3f48e0c3cb0/a1c54fef9b8dc2ea9294a6ed66a37da8223b94bc6a6054e9bd84f3f48e0c3cb0-json.log
  <parse>
  @type json
  time_format %Y-%m-%dT%H:%M:%S.%NZ
  keep_time_key true
  </parse>
  read_from_head true
  pos_file /pilot/pos/a1c54fef9b8dc2ea9294a6ed66a37da8223b94bc6a6054e9bd84f3f48e0c3cb0.istio-app-log3.pos
</source>

omegazeng avatar Mar 05 '21 01:03 omegazeng

你好 问题解决了吗?

Rainbowboys avatar May 07 '21 07:05 Rainbowboys