使用带有 Flume 的 Log4j2 发送短信
Sending text message using Log4j2 with Flume
我有 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>
而 Flume 代理人:
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 服务器控制台上出现错误:"ERROR Recursive call to appender flume",(Flume 代理处于活动状态并且它已正确进行绑定处理)下一个记录器事件没有错误,文件写在 hadoop 上,但是当我尝试使用 HUE 在文本模式下可视化它时,我无法看到我发送的文本,我只能看到二进制代码......
有什么错误吗?或者我必须做什么才能以文本模式写入文件?
谢谢
简单如:
而不是:
<Flume name="flume" >
是:
<Flume name="flume" compress="false" type="Avro">
感谢好人example
我有 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>
而 Flume 代理人:
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 服务器控制台上出现错误:"ERROR Recursive call to appender flume",(Flume 代理处于活动状态并且它已正确进行绑定处理)下一个记录器事件没有错误,文件写在 hadoop 上,但是当我尝试使用 HUE 在文本模式下可视化它时,我无法看到我发送的文本,我只能看到二进制代码...... 有什么错误吗?或者我必须做什么才能以文本模式写入文件? 谢谢
简单如:
而不是:
<Flume name="flume" >
是:
<Flume name="flume" compress="false" type="Avro">
感谢好人example