-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
# Implementation of a Logstash codec for the ArcSight Common Event Format (CEF) | ||
# Based on Revision 20 of Implementing ArcSight CEF, dated from June 05, 2013 | ||
# https://protect724.hp.com/servlet/JiveServlet/downloadBody/1072-102-6-4697/CommonEventFormat.pdf | ||
# | ||
# If this codec receives a payload from an input that is not a valid CEF message, then it will | ||
# produce an event with the payload as the 'message' field and a '_cefparsefailure' tag. | ||
class LogStash::Codecs::CEF < LogStash::Codecs::Base | ||
config_name "cef" | ||
|
||
|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
end | ||
|
||
public | ||
|
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." ...