-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit rules to certain time during the day #492
Comments
I am trying to do this with a new rule type, but I will be better if this use case is supported by the app by default |
Just came here to request the same. In my scenario I want to use a flatline rule to alert if succesful auths to our Radius server stop working (so no successful auths in x minutes). However once everyone goes home for the evening we see a few hours of no auths so the rule would be triggered throughout the night and at weekends. What I'd like is in the rule the ability to say only alert from 9am to 5pm. Only solution I can see at the moment is to alert out to a third party that handles this part of the logic, but native support would be awesome |
Just thought of a workaround here: we could move the relevant rule files out of the rules directory at 5pm with a cron task and move them back into that directory at 9am. As far as I understand, ElastAlert can already handle dynamic changes in the rules directory. I probably give that a try until we come to a conclusion on how to proceed with this feature request. |
If you do that, be sure to set Other than that, that seems like it should work. |
I reached here thinking of the exactly same feature as @lwhitworth wrote. I'll try @jurgenhaas's suggestion for now. Thank you! |
You can configure you filter to ignore records within certain timespans |
Certainly not the most elegant solution, but what i found out seems to work for a flatline kind of rule that should only be triggerd at certain times of the day is a construct like this:
which should count every log entry until 6am as a match (2nd condition) and check if the query_string condition matches between 6am and end of day (1st condition). |
Could the
|
Yes. I'm sorry this has been outstanding for so long. I will try to finish it up soon. |
Hi @Qmando please do help us with this feature its very useful and would be a great addition. |
I landed here for the very same request to run the rule only during certain hours of the day. Let me know if there is any feature enhanced on the same. |
@Qmando Hello, we managed to integrate python APScheduler on our fork of elastalert, thus allowing a cron field in rule yaml. I just didn't have the time to have a pull request. I'll schedule to do one this Friday or weekend (long weekend here in Canada so I should be able to find the time). |
Excellent! How quickly the PR can be merged and get a new JAR version, just to understand when i can integrate with it and plan my activities accordingly. Thanks again! |
@joeyJsonar: Were you able to create and get the PR merged? Thx. |
I've merged this feature into a new branch, This includes a couple other changes as well, like threading support, but you can now limit rule execution to certain times of the day using
Would mean to only run the rule between 7 am and 10 pm every day. This feature is still in beta, of course, but you're welcome to try. |
@Qmando, I've been running with limit_execution for a few days now and it seems to be working well. I believe there might be an issue with the frequency type, where after the cron is done it will go back and alert on the results since the last cron. |
Hi, This is what i get in logs after specifying the range. |
@gsagwan, I was confused at first as well. The limit execution is limiting the rule to run ONLY during that time. So if you want the rule to run and stop during that time you would need to use something like: |
Hi @JaredRietdyk , Thanks for your comments. But it continues to run post 17 as well. |
I think I may see the problem. It's treating the cron schedule as UTC. So when you add 04-17 but, for example, you're in UTC-5 (EST), it's going to actually run from 0-12,23-24. I think I only tested this with minutes and days of the week 🤦♂️ I'll try to get a fix up soon that will treat the schedule as local time. |
Hi @gsagwan , is there an update on this limit_execution property ? I cannot see it in the beta branch and am wanting to track its progress as it's a piece of functionality that will be very useful to our business. |
@thesm3rdo It's there for use already. No update regarding using local timezones, or when this will be released from beta to a full release. |
@Qmando I see that you are pushing things to Master branch but not Beta. |
I created the beta release for testing some large and potentially dangerous changes, in order to get some help testing them. When I merge it into a new release, it will contain everything from the master branch too. Apologies for the very slow pace of releases. |
@Qmando No problem, make the best production release possible ! :) |
@Qmando Hi, any update on merging in to master ? |
I did pull the changes form master into beta. But, I'll probably wait until I've finished the py3 migration to release those changes. Sorry It's been very slow. |
Ok thanks a lot |
I found a solution making an Enhancement so that you can "plug it" on any rule of yours : |
Hi, as today can I know how to implement the limit_execution function in elastalert properly? I use limit_execution: "* 6-23 * * *" in my rule.yml but the rule keep running past 2300 hrs. Also this limit_execution run on local timezone or other timezone? |
Hi @Qmando I would like to ask if this feature is available in elastalert 0.2.2 version. I am looking to check for the rules at a particular time and trigger an alert. May I know how I should achieve it? Can you please guide me by copy pasting the sample alert.yaml file. Say for example if I want to run the rule between 02:00 - 3:00 am UTC time everyday. Say I tried to edit my alert file like this. I am not sure if this is correct, kindly help : `type: frequency
|
HI @Qmando . I have tested limit_execution feature.i have given cron as below Basically it is not executing anytime. elastalert version: v0.2.0 |
Hi! Also wanted to express interest in this feature. It doesn't seem to be in V0.2.4, is there any a plan to enable it soon? |
Would be great if this feature could be added in one of the next releases. |
Any update when will this feature be available? |
elastalert is no more maintained. |
We have a few cardinality rules defined that are checking that our services are running OK by making sure that a certain number of events can be found in ES. Now, some of those rules only make sense within business hours and we would love to define such periods as part of the rules.
In other words, let's enable some rules to be executed only within specific periods each day.
Is that a valid feature request?
The text was updated successfully, but these errors were encountered: