Skip to content

Commit 1b8b7b5

Browse files
committed
Create 500 error alert
1 parent 0eb5a25 commit 1b8b7b5

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

  • infrastructure/modules/container-apps
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
resource "azurerm_monitor_scheduled_query_rules_alert_v2" "five_hundred_error_alert" {
2+
count = var.enable_alerting ? 1 : 0
3+
4+
auto_mitigation_enabled = false
5+
description = "An alert triggered by 500 errors logged in code"
6+
enabled = var.enable_alerting
7+
evaluation_frequency = "PT5M"
8+
location = var.region
9+
name = "${var.app_short_name}-500-error-alert"
10+
resource_group_name = azurerm_resource_group.main.name
11+
scopes = [var.action_group_id]
12+
severity = 2
13+
skip_query_validation = false
14+
window_duration = "PT5M"
15+
workspace_alerts_storage_enabled = false
16+
17+
action {
18+
action_groups = [var.action_group_id]
19+
}
20+
21+
criteria {
22+
operator = "GreaterThan"
23+
query = <<-QUERY
24+
ContainerAppConsoleLogs_CL
25+
| where Log_s contains "500"
26+
QUERY
27+
threshold = 0
28+
time_aggregation_method = "Count"
29+
30+
failing_periods {
31+
minimum_failing_periods_to_trigger_alert = 1
32+
number_of_evaluation_periods = 1
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)