Comparing values percentually #1600
Replies: 7 comments 5 replies
-
Perhaps the Spike Aggregation rule type will solve your needs. Documentation is online at https://elastalert2.readthedocs.io/en/latest/ruletypes.html#spike-aggregation. |
Beta Was this translation helpful? Give feedback.
-
Do some timerange windows not have any events? |
Beta Was this translation helpful? Give feedback.
-
Ok, try specifying |
Beta Was this translation helpful? Give feedback.
-
Ignore that last message I deleted, it turned out to be history messages that, since the response was 404, didn't mark them as sent, so it kept sending them. I just got confused because of the timespans. However, I'm not getting any results anymore, even tho I changed spike_height to 1 and spike_type to both. The only change are the timeframe minutes that I updated to 5, besides that, the rule mantains the same structure. Here is some debug information: elastalert2-1 | 2025-01-23 11:48:47,990 DEBUG Looking for jobs to run I apologize for being a bore. |
Beta Was this translation helpful? Give feedback.
-
I am also not sure if this is working properly everytime. When I have multiple calls with different query_keys, I suspect that, if one of them does not have something to compare to, it breaks all the cycle, not sending any alerts about anything, even if another query_key was compatible with the rule. My suspicion derives from the log, that does not give me a similiar line to this: Here are the logs when the error occurs |
Beta Was this translation helpful? Give feedback.
-
I've already fixed that error and so the next release will avoid crashing the rule in that situation. You can try it now by using the nightly build. To do so, switch to the |
Beta Was this translation helpful? Give feedback.
-
I don't want to be a nuisance, but it still throws an error, but on the next line: elastalert2-1 | File "/usr/local/lib/python3.13/site-packages/elastalert/ruletypes.py", line 528, in find_matches I suppose "ref is not None" on the if would solve the problem. |
Beta Was this translation helpful? Give feedback.
-
Hi. I'm trying to create a rule that triggers when a duration is 150% above the average time of the last 10 minutes, grouped by an Id. I created an elasticsearch transform to facilitate this process, in which it returns that average time grouped by said Id.
What I'm missing is how to compare those values percentually.
Here's a simple example in case I didn't explain it well:
Imagine that in the last 10 minutes there are 5 logs where 'labels.db_statement_encoded' is defined as "1234", and each duration is, respectively, 2, 4, 3, 2, 4. Then, the average duration would be 3. After that, another log with labels.db_statement_encoded equal to "1234" comes with a duration of 4. That should not trigger the rule, since 4 is lower than 150% of the previous average. But if the duration were to be 6, then it would trigger, since it would be 200% of the average duration of the last 10 minutes.
Long story short, I need to know when X number is 150% or more the value of Y.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions