1.寫配置文件
agent:exec source + memory channel + logger sink
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = exec #exec source 可以運行一個給定的shell命令
a1.sources.r1.command = tail -F “預監聽文件的路徑”
a1.sources.r1.shell = /bin/sh -c
a1.sinks.k1.type = logger
a1.channels.c1.type = memory
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
寫入到example2.conf中
2.啓動agent
flume-ng agent \
--name a1 \
--conf $FLUME_HOME/conf \
--conf-file $FLUME_HOME/conf/example2.conf \
-Dflume.root.logger=INFO,console
3.檢測
向data.log中寫入hello world
echo hello world >> data.log
控制檯輸出
成功