Skip to content

Commit

Permalink
[Data Normalization] Remove normalized_types field
Browse files Browse the repository at this point in the history
* Remove this field from record before sending record to outputs (slack, PD, etc).
  • Loading branch information
Chunyong Lin committed Sep 11, 2017
1 parent c725c7c commit b6c4741
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions helpers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,6 @@ def fetch_values_by_datatype(rec, datatype):
result = result[original_key]
results.append(result)

rec.keys().remove('normalized_types')

return results
6 changes: 2 additions & 4 deletions stream_alert/rule_processor/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ def __init__(self, **kwargs):
def __repr__(self):
repr_str = (
'<{} valid:{} log_source:{} entity:{} '
'type:{} record:{} normalized_types:{}>'
'type:{} record:{}>'
).format(
self.__class__.__name__, self.valid,
self.log_source, self.entity,
self.type, self.records,
self.normalized_types
self.type, self.records
)

return repr_str
Expand Down Expand Up @@ -127,7 +126,6 @@ def _refresh_record(self, new_record):
self.records = None
self.type = None
self.valid = False
self.normalized_types = None


class S3ObjectSizeError(Exception):
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/stream_alert_rule_processor/test_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ def test_repr_string():
s3_payload.records = ['rec1', 'rec2']
print_value = ('<S3Payload valid:False log_source:unit_source '
'entity:entity type:unit_type '
'record:[\'rec1\', \'rec2\'] '
'normalized_types:None>')
'record:[\'rec1\', \'rec2\']>')

output_print = s3_payload.__repr__()
assert_equal(output_print, print_value)
Expand Down

0 comments on commit b6c4741

Please sign in to comment.