flume taildir source 采集合并日志

本文介绍了如何使用Flume的TailDirSource监控Docker容器和MySQL日志,并探讨了file_rollsink的文件滚动策略。断点续传功能仅在内容层面,不保留原有文件的更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值