You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are expecting that the "message" will be available as a Hash in LogStash for filtering / transformation, but in reality it comes in LogStash as a string representation of a Ruby Hash and cannot be processed as JSON: {"user"=>"anonym", "mykey"=>"panel2", "duration"=>92}
We are ingesting JSON log files with FileBeat and are forwarding them to a LogStash Instance.
The FileBeat configuration is trivial:
In LogStash a FileBeat input is configured with the default plain codec:
input { beats { port => 5044 } }
In JSON documents in log files the "message" field contains a nested JSON, example:
{"thread": "http-nio-127.0.0.1-10080-exec-1", "level": "INFO", "message": {"mykey": "panel2", "duration": 92, "user": "anonym"}, "loggerFqcn": "org.apache.logging.log4j.spi.AbstractLogger", "contextMap": {"APP": "Racy10", "BROWSER": "curl/7.58.0"},"timestamp": "2021-06-11T15:25:08.842+0200"}
We are expecting that the "message" will be available as a Hash in LogStash for filtering / transformation, but in reality it comes in LogStash as a string representation of a Ruby Hash and cannot be processed as JSON:
{"user"=>"anonym", "mykey"=>"panel2", "duration"=>92}
The cause seems to be here: https://github.com/logstash-plugins/logstash-input-beats/blob/master/lib/logstash/inputs/beats/message_listener.rb#L184
The target field ("message") is extracted here from the input event and converted to a string.
The problem can be easily reproduced with tests, in spec/inputs/beats/message_listener_spec.rb add following test and run it:
The test fails than with the error:
The text was updated successfully, but these errors were encountered: