实时收集日志文件

1.在home下创建一个test文件

2.vim  example.conf  (在flume下的conf文件内)
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = exec
a1.sources.r1.command =tail -F /home/test

# 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

3.启动flume

bin/flume-ng agent -c conf  --conf-file conf/example.conf --name a1 -Dflume.root.logger=INFO,console

实时收集日志文件

 

4.另外启动一个终端输入以下命令 

[root@h1s1 flume]# echo hello huangze hui >> /home/test

5.然后去之前的终端检查输出

实时收集日志文件

 

上一篇:树莓派更换国内镜像源


下一篇:LESSON 2-Discrete Source Encoding