如何为定制日志设置flentd的配置文件

时间:2020-08-01 08:33:50

标签: mongodb fluentd

我想通过Fluentd将定制的日志发送到Mongodb。 下面是日志格式:

2020-01-01 01:34:24,603-recitems.views-INFO-{'id':99, '用户代码':'u9','项目代码':'i9','客户代码':'c9', 'applicationcode':'a9','trackingtype':'click','created': '2020-07-30T01:34:24.598443Z'}

有人可以告诉我如何为Fluentd设置conf文件吗?非常感谢!

这是我的td-agent.conf文件。

<source>
  @type tail
  path /var/log/test/tracking.log
  pos_file /var/log/td-agent/test.access_log.pos
  <parse>
    @type json # ?? i do not know how to set here
  </parse>
  tag mongo.apache.access
</source>

<match mongo.**>
  @type mongo

  database apache
  collection accesslog

  host localhost
  port 27017

  <buffer>
    flush_interval 2s
  </buffer>

  <inject>
    time_key time
  </inject>
</match>

0 个答案:

没有答案