Flume combat: the additional content of the monitoring file

One: the content of the agent configuration file

# 声明agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# 监控test.log文件追加内容
a1.sources.r1.type = exec
a1.sources.r1.command = tail -f /opt/software/flume/datas/test.log

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

Two: Demonstration, the two commands involved

1、启动flume:bin/flume-ng agent -n a1 -c conf/ -f job/file_logger.conf -Dflume.root.logger=INFO,console

2. File appended content: Example: echo 123 >> test.log is appended without overwriting

Note : When r1.type is exec, if there is already content in the monitored file, then the original data will be read by default when starting flume

Window 1:

Window 2:

Demo finished

 

Guess you like

Origin blog.csdn.net/lyw5200/article/details/114745034