Skip to content

Fix the empty compound_query_key value - #3017

Closed
cfatduck wants to merge 1 commit into
YelpArchive:masterfrom
cfatduck:patch-2
Closed

cfatduck wants to merge 1 commit into
YelpArchive:masterfrom
cfatduck:patch-2

Conversation

@cfatduck

Copy link
Copy Markdown

With the existing codes, the rule['compound_compare_key'] is empty when we have only one query_key in the yaml config. And it breaks the custom_format function and hence throwing the exception.

ERROR:root:Traceback (most recent call last):
File "/usr/local/home/user/lib64/python3.6/site-packages/elastalert/elastalert.py", line 1458, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/usr/local/home/user/lib64/python3.6/site-packages/elastalert/elastalert.py", line 1527, in send_alert
enhancement.process(match)
File "/usr/local/home/user/lib64/python3.6/site-packages/elast_format/custom_format.py", line 117, in process
total_hit_real_key = match[self.rule['query_key']]
KeyError: 'query_key'

It seems that the rule['compound_query_key'] is required all time for various functions to be executed if there is at least one.

I have rolled back the change to the previous working one logic, it seems the deletion of rule['query_key'] is not necessary.

With the existing codes, the rule['compound_compare_key'] is empty when we have only one query_key in the yaml config. And it breaks the custom_format function and hence throwing the exception.

ERROR:root:Traceback (most recent call last):
File "/usr/local/home/user/lib64/python3.6/site-packages/elastalert/elastalert.py", line 1458, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "/usr/local/home/user/lib64/python3.6/site-packages/elastalert/elastalert.py", line 1527, in send_alert
enhancement.process(match)
File "/usr/local/home/user/lib64/python3.6/site-packages/elast_format/custom_format.py", line 117, in process
total_hit_real_key = match[self.rule['query_key']]
KeyError: 'query_key'

It seems that the rule['compound_query_key'] is required all time for various functions to be executed if there is at least one.

I have rolled back the change to the previous working one logic, it seems the deletion of rule['query_key'] is not necessary.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant