-
Notifications
You must be signed in to change notification settings - Fork 334
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
[parsers] add cloudtrail via cloudwatch logs support #745
[parsers] add cloudtrail via cloudwatch logs support #745
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.
A really clean solution! 👏
try: | ||
record = json.loads(match.value) | ||
except ValueError: | ||
LOGGER.debug('Embedded json is invalid') |
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.
Should this be a warning? If I understand correctly, this logic parses embedded json (if specified) for each matched log schema. If that fails, then the config is probably wrong? Or will this happen more frequently?
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.
It's probably safe to have it as warning or error. just updated!
👏 @ryandeivert could you also add the new |
@jacknagz I will make a todo for it and address soon |
to: @austinbyers
cc: @airbnb/streamalert-maintainers
size: small
Background
Logs that are ingested via CloudWatch logs subscription filter have a unique format. The format is described here in step 8 under Example # 1. The
message
objects within the list oflogEvents
are stored as embedded json objects. However, currently, there is no easy way to use a json path in combination with loading an embedded json object. This adds support for loading of embedded json objects for json records extracted via a json path.Changes
logs.json
config option ofembedded_json
that is a boolean indicating if the extracted json object is an embedded object (encoded json within json)._extract_records
. This new method also handles the json regex extraction & loading.Testing