简介
taildir source 可以监控一批文件,实时采集信息,且支持断点续传(agent重启后不会重复采集)
该场景下,同时监控两个日志文件,一个是docker容器日志,一个是MySQL的系统日志
任务配置
配置文件如下:
#simple.conf: A single-node Flume configuration
# Name the components on this agent
a2.sources = r1
a2.sinks = k1
a2.channels = c1
# Describe/configure the source
a2.sources.r1.type = TAILDIR
#记录文件读取位置
a2.sources.r1.positionFile = /home/test/tmp/taildir_position.json
#监控读取的文件组
a2.sources.r1.filegroups = f1 f2
# f1文件路径
a2.sources.r1.filegroups.f1 = /data/docker/containers/e511e3e4b3445efeb38fe822ac086dfc5ebb8bdc4a725dc6e2969ef2092c78ec/e511e3e4b3445efeb38fe822ac086dfc5ebb8bdc4a725dc6e2969ef2092c78ec-json.log
# f2文件路径
a2.sources.r1.filegroups.f2 = /data/mysql5.7/data/yd-ss.log
# Describe the sink
a2.sinks.k1.type = file_roll
a2.sinks.k1.sink.directory = /home/test/log/spooldir
# one day roll once
a2.sin