From 471f96c667758c7b7fe6f64289450c8fa146f158 Mon Sep 17 00:00:00 2001 From: sivatarunp Date: Wed, 7 Aug 2024 11:05:45 +0530 Subject: [PATCH] fixing error --- elastalert/ruletypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elastalert/ruletypes.py b/elastalert/ruletypes.py index 048c6c9b9..ddefc58e9 100644 --- a/elastalert/ruletypes.py +++ b/elastalert/ruletypes.py @@ -821,7 +821,8 @@ def check_for_match(self, key, end=True): # Do a deep-copy, otherwise we lose the datetime type in the timestamp field of the last event event = copy.deepcopy(self.occurrences[key].data[-1][0]) event.update(key=key, count=count) - event[self.rules['query_key']]=key + if self.rules['query_key']: + event[self.rules['query_key']]=key self.add_match(event) if not self.rules.get('forget_keys'):