|
1 | | -# resource "azurerm_monitor_scheduled_query_rules_alert_v2" "five_hundred_error_alert" { |
2 | | -# count = var.enable_alerting ? 1 : 0 |
| 1 | +resource "azurerm_monitor_scheduled_query_rules_alert_v2" "five_hundred_error_alert" { |
| 2 | + # commented out for testing, will go in once its passed. |
| 3 | + # count = var.enable_alerting ? 1 : 0 |
3 | 4 |
|
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 |
| 5 | + auto_mitigation_enabled = false |
| 6 | + description = "An alert triggered by 500 errors logged in code" |
| 7 | + enabled = var.enable_alerting |
| 8 | + evaluation_frequency = "PT5M" |
| 9 | + location = var.region |
| 10 | + name = "${var.app_short_name}-500-error-alert" |
| 11 | + resource_group_name = azurerm_resource_group.main.name |
| 12 | + scopes = [var.log_analytics_workspace_id] |
| 13 | + severity = 2 |
| 14 | + skip_query_validation = false |
| 15 | + window_duration = "PT5M" |
| 16 | + workspace_alerts_storage_enabled = false |
16 | 17 |
|
17 | | -# action { |
18 | | -# action_groups = [var.action_group_id] |
19 | | -# } |
| 18 | + action { |
| 19 | + action_groups = [var.action_group_id] |
| 20 | + } |
| 21 | + criteria { |
| 22 | + operator = "GreaterThan" |
| 23 | + query = <<-QUERY |
| 24 | + ContainerAppConsoleLogs_CL |
| 25 | + | where Log_s contains "[ERROR]" |
| 26 | + QUERY |
| 27 | + threshold = 0 |
| 28 | + time_aggregation_method = "Count" |
20 | 29 |
|
21 | | -# criteria { |
22 | | -# operator = "GreaterThan" |
23 | | -# query = <<-QUERY |
24 | | -# ContainerAppConsoleLogs_CL |
25 | | -# | where Log contains "[ERROR]" |
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 | | -# } |
| 30 | + failing_periods { |
| 31 | + minimum_failing_periods_to_trigger_alert = 1 |
| 32 | + number_of_evaluation_periods = 1 |
| 33 | + } |
| 34 | + } |
| 35 | +} |
0 commit comments