-
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
[Data Normalization] Make logs
optional when datatypes
is defined
#307
Conversation
payload.normalized_types, | ||
rule.datatypes) | ||
record['normalized_types'] = types_result | ||
if rule.datatypes is not None: |
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.
Optional: The is not None
here is implicit with just if rule.datatypes:
return False | ||
|
||
for datatype in datatypes: | ||
if not datatype in normalized_types: | ||
LOGGER.error('The datatype [%s] is not defined!', datatype) |
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.
Is this logging statement no longer helpful? I understand why the one above was removed but can you explain why this one was also?
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.
Since we removed log_sources
constrain, one rule will matched to multiple records. Normalized types dictionaries are defined based on each log source though. It is not an error if normalized type foo
doesn't defined in Record A, it just doesn't match and return False
is enough. Does it make sense to you?
@chunyong-lin - For the testing, please ensure there is a test for all possible permutations and update the PR description:
|
log_source
constrain.logs
optional when datatypes
is defined
2f16953
to
c725c7c
Compare
@mime-frame @ryandeivert PTAL, I also updated my test status to PR description. Thanks 😸 |
* Add unit tests to test `logs` and `datatypes` in rule header. They cover 4 cases: * logs is present, datatypes is not - working as expected * logs is present, datatypes is - working as expected * logs is not present, datatypes is not - log an ERROR * logs is not present, datatypes is - working as expected.
b6c4741
to
3dd0e15
Compare
* Remove this field from record before sending record to outputs (slack, PD, etc).
3dd0e15
to
201aa1e
Compare
@chunyong-lin - to confirm, this is ready for review? |
@mime-frame Yes, it is ready for review. |
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.
LGTM
to @ryandeivert @mime-frame
cc @airbnb/streamalert-maintainers
size: tiny
contributes to: #304
Summary
Remove
log_source
constrain which meanslogs
keyword is optional when we define a rule ifdatatypes
keyword present. Otherwiselogs
keyword is required.Apply Data Normalization feature to a rule, we can define a rule in this format
Changes
Testing
logs
is present,datatypes
is notlogs
is present,datatypes
islogs
is not present,datatypes
islogs
is present,datatypes
is not - working as expectedlogs
is present,datatypes
is - working as expectedlogs
is not present,datatypes
is not - log an ERRORlogs
is not present,datatypes
is - working as expected.