如何使用fluentD解析多行泊坞日志?

时间:2017-04-27 16:27:35

标签: elasticsearch docker kibana fluentd

我正在尝试使用fluentD驱动程序,流畅,有弹性,kibana来聚合我的docker-compose记录环境。

日志正确转发但嵌套的JSON对象每个都记录为单个事件(参见图像)。

enter image description here

这是使用自定义正则表达式构建数据的正确方法吗?

我的fluentd.conf

中有以下内容
<source>
  type forward
  port 24224
  bind 0.0.0.0
</source>

<match docker.**>
  type elasticsearch
  logstash_format true
  logstash_prefix logstash
  host elasticsearch
  port 9200
  flush_interval 5s
</match>

1 个答案:

答案 0 :(得分:0)

Tkwon123 - 我是否正确您希望在Docker容器中编写JSON日志并让每个JSON对象显示为1个kibana日志?

如果我理解正确,您似乎只需要确保打印的JSON日志只有结束回车符。在查看你的屏幕截图时,看起来你可能正在打印JSON对象,这会在多行上将它分开。

希望我理解你的问题。