我想通过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>