* 技术选型
![](https://img.kancloud.cn/bc/cd/bccd49edcd1e5bc22739b9505ad556d9_664x30.png)
*其中 exec 数据源是执行linux命令的,比如cat 、tail去跟踪文件的新增内容。
![](https://img.kancloud.cn/c6/1e/c61e8b42b41ea8ed1459b0767ab0cb76_1037x195.png)
* 修改配置文件
```
# 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里面输入新的内容。
![](https://img.kancloud.cn/d4/74/d47498e3b542c7431f27c877bb5d717d_1142x460.png)