Conditional Threshold rule and math aggregations in Rule file #312
-
Hi Team, Is there a way to - Run filter ratio or math aggregations in the rule file itself to calculate percentage from an integer/double/float field. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
I'm reading two questions in this post:
For #1, I suggest using two rules, with rule A having a threshold of 5, and rule B having a threshold of 10. Rule A alerts go to email group X, and rule B alerts go to email group Y. When the count exceeds threshold of 5, only group X receives the alert. When the count exceeds threshold of 10, both groups X and Y receive the alert. As far as I know it is not possible to stop the alerts going to the first group X once the count continues exceeding the lower threshold. For #2, see the percentage_match example for a sample rule that attempts what you're requesting. |
Beta Was this translation helpful? Give feedback.
-
Hey @firdausa-iprogrammer - if as you suggest in #312 (reply in thread) you have a large number of management levels and don't want to duplicate the conditional logic, I think your best option at the moment is to write a custom alerter. This is quite easy - see here for documentation and here for an example of a simple alerter - and you can easily inherit from a parent alerter class. So what I'm proposing is that - for example - if you were looking to alert into Slack, you could define the rule you need exactly as you would define any other Slack rule, and have a custom alerter that is a subclass of the Slack alerter. You can then check the length of the In terms of the broader ElastAlert project, any threshold-based behaviour would have to be carefully thought out and implemented in as generic a manner as possible to avoid confusing behaviour across alerters. I doubt this will be implemented in the near future, so I think going the custom route is the quickest and easiest way to what you need. We use a custom alerter in my organisation to achieve a simple level of priority-based behaviour across different alerting platforms, which is similar to what you suggest. I'm happy to help answer questions about implementation if you go down this route. |
Beta Was this translation helpful? Give feedback.
-
Hi @jertel and @ferozsalam, Is it possible to extend the command alerter? How would my logic change in that case? |
Beta Was this translation helpful? Give feedback.
-
To answer myself - Here's my custom alerter -
RULE CHANGES
@ferozsalam and @jertel If you could give me any suggestions to improve this it would be much appreciated! |
Beta Was this translation helpful? Give feedback.
-
Hi! So sorry to bug you guys about this again, my company now wants to switch from Signal to Telegram. When I was using signal-cli for alerts \n worked to get the text in a new line.
When I fire this same command from bash even with However when I trigger the alert from elastalert it sends all the data but with only about 2 character space
How do I format my curl command to work like it works on it's own? |
Beta Was this translation helpful? Give feedback.
To answer myself -
Here's my custom alerter -