* 技術選型

*其中 exec 數據源是執行linux命令的,比如cat 、tail去跟蹤文件的新增內容。

* 修改配置文件
```
# example.conf: A single-node Flume configuration
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
# a1.sources.r1.type = netcat
# 修改數據源
a1.sources.r1.type = exec
# a1.sources.r1.bind = localhost
# 監控文件的更新
a1.sources.r1.command = tail -F /home/bizzbee/data/data.log
a1.sources.r1.shell = /bin/sh -c
# a1.sources.r1.port = 44444
# 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
```
* 把改好的配置寫進文件,這里新建一個。`exec-memory-logger.conf`
* 啟動flume
```
flume-ng agent --name a1 --conf $FLUME_HOME/conf --conf-file $FLUME_HOME/conf/exec-memory-logger.conf -Dflume.root.logger=INFO,console
```
* 然后向data.log里面輸入新的內容。
