logback发送失败, LogstashSocketAppender和LogstashTcpSocketAppender同时使用才能发送log 给logstash
默认分类 | 作者 jamie | 发布于2017年09月22日 | 阅读数:8979
logback 使用logstash-logback-encoder-4.11 发送log到logstash,我必须同时添加TCP(LogstashTcpSocketAppender)、UDP(LogstashSocketAppender) 才能发送成功,一直不明白是哪里有问题?
logback.xml 配置代码段:
<appender name="socket"
class="net.logstash.logback.appender.LogstashSocketAppender">
<host>192.168.101.102</host>
<port>9250</port>
</appender>
<appender name="stash"
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>192.168.101.102:9250</destination>
<encoder charset="UTF-8"
class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="RollingFile" />
<appender-ref ref="errorFile" />
<appender-ref ref="infoFile" />
<appender-ref ref="stash" />
<appender-ref ref="socket" />
</root>
logstash.conf 配置:
input {
tcp {
port => 9250
codec => "json"
}
}
output {
stdout {
codec => rubydebug }
elasticsearch {
hosts => ["localhost:9200"]
flush_size => 1000
}
}
我必须同时使用stash和socket, logstash 才能收到,如果只使用其中一个logstash是不到message,各位大神有遇见这样的情况吗?
logback.xml 配置代码段:
<appender name="socket"
class="net.logstash.logback.appender.LogstashSocketAppender">
<host>192.168.101.102</host>
<port>9250</port>
</appender>
<appender name="stash"
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>192.168.101.102:9250</destination>
<encoder charset="UTF-8"
class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="RollingFile" />
<appender-ref ref="errorFile" />
<appender-ref ref="infoFile" />
<appender-ref ref="stash" />
<appender-ref ref="socket" />
</root>
logstash.conf 配置:
input {
tcp {
port => 9250
codec => "json"
}
}
output {
stdout {
codec => rubydebug }
elasticsearch {
hosts => ["localhost:9200"]
flush_size => 1000
}
}
我必须同时使用stash和socket, logstash 才能收到,如果只使用其中一个logstash是不到message,各位大神有遇见这样的情况吗?
0 个回复