0
我正在使用Logback從我的Grails應用程序發送日誌到ELK堆棧。Logback到Logstash編碼錯誤
我的logback appender的
appender("tcp", LogstashTcpSocketAppender) {
destination = "localhost:5044"
SSLConfiguration aSsl = new SSLConfiguration()
aSsl.trustStore = new KeyStoreFactoryBean()
aSsl.trustStore.location = "classpath:logstashTrustStore.jks"
aSsl.trustStore.password = "test123"
if(aSsl.trustStore instanceof LifeCycle)
aSsl.trustStore.start()
if(aSsl instanceof LifeCycle)
aSsl.start()
ssl = aSsl
encoder(LogstashEncoder) {
encoding = "UTF-8"
}
}
我logstash輸入配置是
input {
tcp {
port => 5044
mode => "server"
type => log4j
}
}
當我開始我的應用程序的日誌發送到ELK堆棧,但我得到以下警告
[2017-01-22T10:57:14,801][WARN ][logstash.codecs.line ] Received an event that has a different character encoding than you configured. {:text=>"\\a\\xDCl\\x86\\xFEڐ\\xD1\\u0006\\x92J\\xBDMTLN\\[email protected]\\x93\\x9B\\x8E\\xC1\\xE8&\\xF5|\\xF1\\xF4\\u0000\\u0000:\\xC0#\\xC0'\\u0000<\\xC0%\\xC0)\\u0000g\\[email protected]\\xC0\\t\\xC0\\u0013\\u0000/\\xC0\\u0004\\xC0\\u000E\\u00003\\u00002\\xC0+\\xC0/\\u0000\\x9C\\xC0-\\xC01\\u0000\\x9E\\u0000\\xA2\\xC0\\b\\xC0\\u0012\\u0000", :expected_charset=>"UTF-8"}
我在Kibana中可以看到的日誌只包含那樣的消息,但我不明白在哪裏編碼錯誤可能來自於我配置我的日誌appender使用UTF-8和Logstash似乎期待UTF-8。
我在做什麼錯?
我非常確定,我的LogstashEncoder以UTF-8編碼方式發送數據,因爲我明確指出了編碼器的編碼。我也用這個編碼器寫入一個文件,編碼當然是UTF-8 – Tobson