# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 __copyright__ = ('Copyright Amazon.com, Inc. or its affiliates. ' 'All Rights Reserved.') __version__ = '2.10.0' __license__ = 'MIT-0' __author__ = 'Shunsuke Goto' __url__ = 'https://github.com/aws-samples/siem-on-amazon-opensearch-service' import re from functools import cached_property from aws_lambda_powertools import Logger from siem import FileFormatBase logger = Logger(child=True) RE_LOGRAW = r'((CEF:\s?\d+)([^=\\]+\|){,7})(.*)' RE_HEADER = r'(? 6: logdict['cef_severity'] = header_splits[6] extension = res.group(4) extension_dict = dict() for key, value in re.findall(RE_EXTENSION, extension): extension_dict[key] = value for key in list(extension_dict.keys()): if key[-5:] == 'Label': custom_label = key[:-5] if custom_label in extension_dict.keys(): extension_dict[extension_dict[key]] \ = extension_dict[custom_label] del extension_dict[custom_label] del extension_dict[key] logdict.update(extension_dict) return logdict