2015-02-10 84 views
0

短信我有Log4j2配置:發送使用Log4j2與水槽

<?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> 

而且水槽劑:

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 

當我發送日誌,我第一次得到我的web服務器控制檯錯誤:「錯誤遞歸調用appender flume」(Flume Agent處於活動狀態,它已經正確地進行了綁定)在下一個記錄器事件中沒有錯誤,並且文件寫在hadoop上,但是當我嘗試在文本模式下將其可視化HUE,我找不到我發送的文本,我只看到二進制代碼... 是有什麼錯誤?或者我必須這樣做,我可以在文本模式下編寫文件? 謝謝

回答

0

一樣簡單:

相反的:

<Flume name="flume" > 

是:

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

由於擁有良好的example