立即学习:https://edu.csdn.net/course/play/8876/183493
主机戳拦截器:向event header中,增加主机名信息
a1.sources = r1
a1.sinks = k1
a1.channles = c1
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = /root/flumeInter
a1.sources.r1.interceptors = i1 i2
a1.sources.r1.interceptors.i1.preserveExisting = false
a1.sources.r1.interceptors.i1.type = timestamp
a1.sources.r1.interceptors.i2.type = host
a1.sources.r1.interceptors.i2.hostHeader = host
a1.sources.r1.interceptors.i2.useIP = false
a1.sink.k1.type = logger
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sinks.k1.channel= c1
flume-ng agent -n a1 -c /opt/software/apache-flume-1.6.0-cdh5.14.0-bin/flumeconf -f hostInter.conf -Dflume.root.logger=INFO,console
正则拦截器:
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = /root/flumeData
a1.sources.r1.interceptors = i1
a1.sources.r1.interceptors.i1.type = regex_filter
a1.sources.r1.interceptors.i1.regex = ^[0-9]*$
a1.sources.r1.interceptors.i1.excludeEvents = true
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://hadoop111:9000/flume/regex
a1.sinks.k1.hdfs.fileType = DataStream
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
注意:
sink 连接 channel 是 channel
source 连接 channel 是 channels