Closed sandrinr closed 7 years ago
Guys, this is such a trivial change. Can you take it without me signing the CLA? You can just copy it. I don't care about the attribution ;-).
I am just wondering when this situation can occur, have we done some investigation why we receive an empty document, I am not really familliar with gelf.
For me this happened when the sending process (in my case a PHP script) was abruptly terminated and because of this sent invalid or empty messages.
@sandrinr It is still the case with one of the latest version of the plugin? Because https://github.com/logstash-plugins/logstash-input-gelf/pull/44/files#diff-307abaee619bf0d2453f131f219febd5R111 should prevent nil (or incomplete) data to be parsed.
And if we try to parse any invalid data the parser will just raise an exception that we catch.
This is a long time ago and I am having a hard time to remember. I think something in LogStash::Event.new(o)
depended o
not being nil, resulting in other errors than LogStash::Json::ParserError
.
Thanks for the quick response @sandrinr, I went through the code with the guard next if data.nil
, It wont be an issue anymore I will close this PR.
This change should also (or especially) be applied to the "2.0.x" release stream.