Duplicate Alert Rules across Projects

We use same alert rules(with Slack) across Projects. We go to each project and apply the alert rules. Is it possible to duplicate alert rules or have a centralized alert rules?

7 Likes

It’s not today. We talked at least about making some kind of JSON advanced editor that would let you clean copy/paste (or bulk apply via API).

I agree as I have just split out applications into specific projects in sentry, but this means I have to manually go and apply alerting rules for each project.

Either some API level access, or global alerting rules with a tick box to apply those rules to all new projects or not would be really helpful.

Yes. Im so tired to put all rules manually for every small project. Please make API for this or create global rules

Just started with Sentry and think it works great.
Also would like to see some functionality on duplicating rules. Or even better maybe, be able to create and modify rules, and then attach them to desired projects.

Cheers
-jo

Hey, it’s been a while. We have a few dozen projects, and copying the same rules across all of them manually is pretty tedious and error prone. Any update?

Hi, is there any place where I could upvote this feature request? We have around 20 projects and would like to have multiple different alerts corresponding to different severities (normal, high, blocker) with different setup. That makes it 60 alert rules total. If it was one-off setup, that would be bearable, but the thresholds are not fixed and we want to be iteratively changing them and continuously decreasing/adapting them according to the situation. But the fact that I’d have to manually update all 60 alert rules discourages me from doing that and degrades value of otherwise great alerting feature.

you can do almost anything through the api. Even tho its not documented

This is how I added alerts for x amount of projects
$apps = @(“project1”, “Project2”)
$authToken = “CREATE_TokenWith_project:write”

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $authToken")

foreach ($app in $apps) {
  $app = $app.ToLower()
  $location = "https://myurl.com/api/0/projects/nasa.gov/${app}/rules/"
  Invoke-WebRequest -Uri $location -Method Post -Body "{`"actionMatch`":`"all`",`"filterMatch`":`"all`",`"actions`":[{`"id`":`"sentry.integrations.slack.notify_action.SlackNotifyServiceAction`",`"workspace`":`"1`",`"channel`":`"#sentry-verbose`"}],`"conditions`":[{`"id`":`"sentry.rules.conditions.first_seen_event.FirstSeenEventCondition`"}],`"filters`":[],`"name`":`"Slack on new issue for ${app}`",`"frequency`":30}" -Headers $headers -ContentType "application/json; charset=utf-8"
}

This post helped me alot:

Hope this can be of some use for someone

When using microservices this is quite difficult, we have 70 services today

I would like to simply change the destination of the alert based on the env (so accross all projects, one same rule)

The reply above to simulate the http calls would work, but we would have to run it everytime we create a new project, we will forget at some point

This “requests” on proper management alerts on account level (or easier integration for multiple projects) seems still very valid and not at all tackled (even in the API).

I also find the workaround above not ideal and pretty unreliable.
Some new feedback from the team would be nice.

Thanks for the idea @Alexander !I made small python script to help automate this

1 Like