-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tag _cefparsefailure on parse failure #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over all it looks good to me, only a few minor suggestions.
The CEF specification () states in section Header Field Definitions that the version (field cef_version) is an integer. Maybe we should throw an exception if this is not the case as it is not valid CEF. This should go after https://github.com/logstash-plugins/logstash-codec-cef/pull/26/files#diff-60997264fb4df8acacfb3987dc3049a5L95
@@ -114,6 +117,9 @@ def decode(data) | |||
end | |||
|
|||
yield event | |||
rescue => e | |||
@logger.error("Failed to decode event payload. Generating failure event with payload in message field.", :error => e.message, :backtrace => e.backtrace, :data => data) | |||
yield LogStash::Event.new("message" => data, "tags" => ["_cefparsefailure"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logstash-filter-json allows to configure the tag for the failure case: https://github.com/logstash-plugins/logstash-filter-json/blob/master/lib/logstash/filters/json.rb#L60
should we provide similar behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they most used one (codec json) doesn't allow it, so I'm not that concerned, maybe we can have this as is and eventually add it if needed?
@@ -114,6 +117,9 @@ def decode(data) | |||
end | |||
|
|||
yield event | |||
rescue => e | |||
@logger.error("Failed to decode event payload. Generating failure event with payload in message field.", :error => e.message, :backtrace => e.backtrace, :data => data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add some kind of reference to CEF to the error log message. While checking the logs it would be easier to understand the error.
Maybe something like: "Failed to decode CEF payload." ...
Forgot to paste the link to the CEF specification: https://www.protect724.hpe.com/servlet/JiveServlet/downloadBody/1072-102-9-20354/CommonEventFormatv23.pdf |
@jsvd Today I wanted to review your PR and let the spec tests run on my machine. Unfortunately this does not work. May be you can give me an hint what might be the problem. After updating to java 1.8.0_101 and running
The same also happens on current master of this plugin. Therefore I think this problem is not related to your PR. |
@breml strange, I tried to replicate your issue with jruby 1.7.19 but failed to:
|
@jsvd I tried again today even with removal of jruby and reinstallation with the same steps you executed. The bad news is: it does still not work completely.
Does this mean anything to you? |
Today I tried again and I first removed the Gemfile.lock and reinstalled the Gems with This showed me, that your PR is depending on a recent version of the @jsvd what do you think? Other than that, there is no longer any reason to not merge this PR. |
To those getting here via Google 4 years later, just add |
fixes #25