From f7a7497d0f7b7f6b9f322d12647b9e15f5f590ec Mon Sep 17 00:00:00 2001 From: Piotr Pauksztelo Date: Fri, 22 Sep 2023 07:34:47 +0200 Subject: [PATCH] Refactor pre_detector --- logprep/processor/pre_detector/processor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/logprep/processor/pre_detector/processor.py b/logprep/processor/pre_detector/processor.py index 3fce3c4ed..9364f58dd 100644 --- a/logprep/processor/pre_detector/processor.py +++ b/logprep/processor/pre_detector/processor.py @@ -126,11 +126,10 @@ def _apply_rules(self, event, rule): if self._logger.isEnabledFor(DEBUG): # pragma: no cover self._logger.debug(f"{self.describe()} processing matching event") self._get_detection_result(rule, self._extra_data) - if "@timestamp" in event: - for detection in self._extra_data: - detection["@timestamp"] = event["@timestamp"] for detection in self._extra_data: detection["creation_timestamp"] = TimeParser.now().isoformat() + if "@timestamp" in event: + detection["@timestamp"] = event["@timestamp"] def _get_detection_result(self, rule: PreDetectorRule, detection_results: list): if self._event.get("pre_detection_id") is None: