需要修改一下配置文件的信息
原配置文件:
a1.sources = r1
a1.sinks = k1
a1.channels = c1
#配置Source
a1.sources.r1.type=syslogtcp
a1.sources.r1.port = 5140
a1.sources.r1.host = localhost
#配置Sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://localhost:9000/user/node01/flume/syslogtcp
a1.sinks.k1.hdfs.filePrefix = Syslog
a1.sinks.k1.hdfs.round = true
a1.sinks.k1.hdfs.roundValue = 10
a1.sinks.k1.hdfs.roundUnit = minute
#配置Channel
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
#绑定Source和sink到channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
在配置sink中添加一句:
a1.sinks.k1.hdfs.fileType=DataStream
即可按文件的原样输出