1)创建Flume Agent配置文件 flume-file-logger.conf
2)在配置文件中添加以下内容 参照https://flume.apache.org/FlumeUserGuide
# example.conf: A single-node Flume configuration
# Name the components on this agent
a2.sources = r2
a2.sinks = k2
a2.channels = c2
# Describe/configure the source
a2.sources.r2.type = exec
a2.sources.r2.command = tail -F /tmp/input.txt
a2.sources.r2.shell = /bin/bash -c
# Describe the sink
a2.sinks.k2.type = logger
# Use a channel which buffers events in memory
a2.channels.c2.type = memory
a2.channels.c2.capacity = 1000
a2.channels.c2.transactionCapacity = 100
# Bind the source and sink to the channel
a2.sources.r2.channels = c2
a2.sinks.k2.channel = c2
3) Flume启动agent a2,然后往文件 /tmp/input.txt file中添加内容。我们可以看到消息传了过来。