Skip to content

Dynamic Slack Webhook Option #1520

Answered by jertel
VirusProtect asked this question in Q&A
Aug 19, 2024 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

Slack alerter URLs are initialized when ElastAlert 2 starts up and loads the rule into memory. At that time the Alerter class is initialized with the configured URL. So changing the rule object's slack URL at runtime won't make a difference since the alerter instance was already initialized.

The Slack alerter supports dynamically changing rooms/channels, but not the actual Slack webhook itself.

To do what you're attempting would require manipulating the URL in the alerter instance, not the rule instance. Ex:

        for alerter in self.rule['alert']:
            if isinstance(alerter, SlackAlerter):
                alerter.slack_webhook_url = [new_webhook]

Also, the slack_webhook_url is …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@VirusProtect
Comment options

@jertel
Comment options

Answer selected by jertel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants