J.F.
J.F.

Reputation: 403

Sending text message using Log4j2 with Flume

I have Log4j2 configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appenders>

        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d %-5p - %m%n"/>
        </Console>
      <Flume name="flume" >
            <MarkerFilter marker="FLUME" onMatch="ACCEPT" onMismatch="DENY"/>
            <Agent host="IP_HERE" port="6999"/>
      </Flume>
      <File name="file" fileName="flume.log">
            <MarkerFilter marker="FLUME" onMatch="ACCEPT" onMismatch="DENY"/>
        </File>      
    </appenders>

    <loggers>
        <root level="info">
            <appender-ref ref="file"/>
            <appender-ref ref="console"/>
         <appender-ref ref="flume"/>
        </root>

    </loggers>
</configuration>

And the Flume agent:

agent1.channels = ch1
agent1.sources = avro-source1
agent1.sinks = hdfs-sink1

agent1.channels.ch1.type = memory

agent1.sources.avro-source1.type = avro
agent1.sources.avro-source1.bind = IP_HERE
agent1.sources.avro-source1.port = 6999

agent1.sinks.hdfs-sink1.type = hdfs
agent1.sinks.hdfs-sink1.hdfs.path = hdfs://hadoop/user/hduser/bond/flume
agent1.sinks.hdfs-sink1.hdfs.fileType = DataStream
agent1.sinks.hdfs-sink1.hdfs.writeFormat = Text


agent1.sinks.hdfs-sink1.channel = ch1
agent1.sources.avro-source1.channels = ch1

When I send a log,first time I get on my web server console an error: "ERROR Recursive call to appender flume",(Flume Agent is active and it has made bind process correctly) on next loggers events theres no error and a file is written on hadoop, But when I try to visualise it in Text mode with HUE, I can't se the text I have sent, I only see binary codes... Is there any mistake? or what I have to do so I can write the file in text mode? Thank you

Upvotes: 0

Views: 899

Answers (1)

J.F.
J.F.

Reputation: 403

As easy as:

Instead of:

 <Flume name="flume" >

Is:

<Flume name="flume" compress="false" type="Avro">

Thanks to a good example

Upvotes: 0

Related Questions