Skip to content
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

How to silence the rule via api? #101

Open
ashliakhov opened this issue Feb 26, 2025 · 3 comments
Open

How to silence the rule via api? #101

ashliakhov opened this issue Feb 26, 2025 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ashliakhov
Copy link

Hey, thanks for the great project!

Newbie question, but how can I silent (or disable) the particular rule using swagger?

Any hint is appreciated 🙏

@Karql
Copy link
Owner

Karql commented Feb 26, 2025

Hi,

Currently there is no such method to do it in swagger.

You can try edit rule and add is_enabled to it.

https://elastalert2.readthedocs.io/en/latest/ruletypes.html
Image

You can also delete rule and restore it later.

If you have access to elastic you add document to silence index directly.
https://github.com/jertel/elastalert2/blob/master/elastalert/elastalert.py#L1778

As a target solution, I would suggest add a new method in the API.
Method should take two parameters

  • rule name
  • silent duration
    and starts a new elastalert2 process with --rule and --silence flags.

https://elastalert2.readthedocs.io/en/latest/flags.html
Image

However, I won’t have time for this in the near future – a PR is always welcome! ;)

Note for dev purpose: https://github.com/jertel/elastalert2/pull/1004/files#r1018520966
@jertel was right. The behavior here will be differen. If someone uses only --silence, it will match by rule name, but with --silence_qk_value, it will match by realert_key.

Best regards,
Mateusz

@Karql Karql added enhancement New feature or request help wanted Extra attention is needed labels Feb 26, 2025
@ashliakhov
Copy link
Author

@Karql
Thanks a lot! Will give it a try 👍

@nsano-rururu
Copy link

@ashliakhov
johnsusek/elastalert-server only supports --silence.
--silence_qk_value is not supported.

@Karql

Are there plans to support this in elastalert2-server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants