From b21dcf7768a6d33d91cf2b9c3eee30b09a41b7c6 Mon Sep 17 00:00:00 2001 From: Chema Martinez Date: Wed, 29 Nov 2017 10:30:24 +0100 Subject: [PATCH] Fix AWS integration: Discard null fields from json output Add source log file to json output --- tools/amazon/getawslog.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/amazon/getawslog.py b/tools/amazon/getawslog.py index 99c0a01b4..037603551 100644 --- a/tools/amazon/getawslog.py +++ b/tools/amazon/getawslog.py @@ -112,8 +112,13 @@ def main(argv): j = json.load(data) if "Records" not in j: continue - for item in j["Records"]: - aws_log = {'aws': item} + for json_event in j["Records"]: + new_dict = {} + for key in json_event: + if json_event[key]: + new_dict[key] = json_event[key] + new_dict['log_file'] = newFile + aws_log = {'aws': new_dict} log.write("{0}\n".format(json.dumps(aws_log))) log.close()