hadoop - Flume and HDFS: Create one file per host and application -
i have several java applications using log4j may or not on same host.
i've successfuly configured flume , log4j persist single file per day, how can make flume create separate directories based on host , application name?
this flume log4j appender:
<flume name="flumelogger" compress="false" batchsize="1" type="persistent" datadir="logs/flume"> <agent host="myhost" port="41414"/> <patternlayout pattern="@@@@ %d{iso8601} %p ${env:computername} my-app %c %m @@@@"/> </flume>
and flume configuration:
agent1.sinks.hdfs-sink1.type = hdfs agent1.sinks.hdfs-sink1.hdfs.path = hdfs://localhost:9000/logs/%{host} agent1.sinks.hdfs-sink1.hdfs.fileprefix = %y-%m-%d agent1.sinks.hdfs-sink1.hdfs.round = true agent1.sinks.hdfs-sink1.hdfs.roundvalue = 1 rgent1.sinks.hdfs-sink1.hdfs.roundunit = day agent1.sinks.hdfs-sink1.hdfs.rollinterval = 0 agent1.sinks.hdfs-sink1.hdfs.rollfile = 0 agent1.sinks.hdfs-sink1.hdfs.rollsize = 0 agent1.sinks.hdfs-sink1.hdfs.rollcount = 0 agent1.sinks.hdfs-sink1.hdfs.writeformat = text agent1.sinks.hdfs-sink1.hdfs.filetype = datastream agent1.sinks.hdfs-sink1.hdfs.batchsize = 1 agent1.sinks.hdfs-sink1.hdfs.uselocaltimestamp = true agent1.channels = ch1 agent1.sources = avro-source1 agent1.sinks = hdfs-sink1 agent1.sinks.hdfs-sink1.channel = ch1 agent1.sources.avro-source1.channels = ch1
from documentation:
%{host}: substitute value of event header named “host”. arbitrary header names supported.
however logs being written in /logs
instead of /logs/myhost
specified on hdfs.path
property.
additionally, how can define arbitrary header names
in log4j appender?
Comments
Post a Comment