Encoding Logback到Logstash编码错误

Encoding Logback到Logstash编码错误,encoding,logstash,logback,elastic-stack,logstash-logback-encoder,Encoding,Logstash,Logback,Elastic Stack,Logstash Logback Encoder,我使用Logback将日志从Grails应用程序发送到ELK堆栈 我的logback appender appender("tcp", LogstashTcpSocketAppender) { destination = "localhost:5044" SSLConfiguration aSsl = new SSLConfiguration() aSsl.trustStore = new KeyStoreFactoryBean() aSsl.trustStore.locatio

我使用Logback将日志从Grails应用程序发送到ELK堆栈

我的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"
  }
}
我的日志存储输入配置为

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\\xBF@\\x93\\x9B\\x8E\\xC1\\xE8&\\xF5|\\xF1\\xF4\\u0000\\u0000:\\xC0#\\xC0'\\u0000<\\xC0%\\xC0)\\u0000g\\u0000@\\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"}

[2017-01-22T10:57:14801][WARN][logstash.codecs.line]收到一个事件,该事件的字符编码与您配置的不同。{:text=>“\\a\\xDCl\\x86\\xFEڐxD1\\u0006\\x92J\\xBDMTLN\\xBF\\x93\\x9B\\x8E\\xC1\\xE8&\\xF5|\\xF1\\xF4\\u0000\\u0000:\\xC0#xC0'\\u0000这是因为默认的字符集是UTF-8,您可能需要在
输入中设置正确的字符集

input {
  tcp {
    port => 5044
    mode => "server"
    type => log4j
    codec => plain {
       charset => "ISO-8859-1"
    }
  }
}

可用。您可以查看更多信息。希望它有帮助!

我非常确定,我的LogstashEncoder正在以UTF-8编码发送数据,因为我已经明确了编码器的编码。我还使用此编码器写入文件,其中的编码肯定是UTF-8