Graylog2 / gelfclient

GELF client library for Java based on Netty 4
https://www.graylog.org/
Apache License 2.0
38 stars 19 forks source link

\0 Byte inside udp Gelf #20

Closed hggh closed 8 years ago

hggh commented 8 years ago

I'm using stream output with GELF udp to send log messages to logstash. The following log message occurs on the logstash side:

gelf listener died {:exception=>#<LogStash::Json::ParserError: Illegal character ((CTRL-CHAR, code 0)): only regular white space (\r, \n, \t) is allowed between tokens
 at [Source: [B@7944757a; line: 1, column: 1083]>, :backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.5-java/lib/logstash/json.rb:41:in `jruby_load'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-gelf-1.0.0/lib/logstash/inputs/gelf.rb:109:in `udp_listener'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-gelf-1.0.0/lib/logstash/inputs/gelf.rb:62:in `run'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.5-java/lib/logstash/pipeline.rb:177:in `inputworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.5-java/lib/logstash/pipeline.rb:171:in `start_input'"], :level=>:warn}

The problem is the 0 Byte separator from GL2 to logstash:

https://github.com/Graylog2/gelfclient/blob/master/src/main/java/org/graylog2/gelfclient/encoder/GelfMessageJsonEncoder.java#L110-L111

viq commented 8 years ago

@hggh I see the same thing, maybe it would be an idea to create a ticket at https://github.com/logstash-plugins/logstash-input-gelf/issues ?

viq commented 8 years ago

I created https://github.com/logstash-plugins/logstash-input-gelf/issues/29 on their end.