Skip to content

Commit

Permalink
🔧 Double the sample period to decrease frequency of log alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepstaylor committed Aug 19, 2024
1 parent 01a4780 commit 07f2245
Showing 1 changed file with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ resource "aws_cloudwatch_metric_alarm" "memory_over_threshold" {
}

resource "aws_cloudwatch_log_metric_filter" "log_error_filter" {
name = "ldap-${var.env_name}-error"
name = "ldap-${var.env_name}-error"
# Pattern to match errors but exclude err=32
pattern = "[%]err=([1-9][0-9]+)[%] (?:(?!err=32).)*"
pattern = "%err=[1-9][0-9]+%"

log_group_name = aws_cloudwatch_log_group.ldap_ecs.name

Expand All @@ -95,7 +95,7 @@ resource "aws_cloudwatch_metric_alarm" "high_error_volume" {
namespace = "ldapMetrics"
metric_name = "ErrorCount"
statistic = "Sum"
period = "300"
period = "600"
evaluation_periods = "1"
alarm_actions = [var.sns_topic_arn]
ok_actions = [var.sns_topic_arn]
Expand All @@ -104,21 +104,6 @@ resource "aws_cloudwatch_metric_alarm" "high_error_volume" {
comparison_operator = "GreaterThanThreshold"
}

resource "aws_cloudwatch_metric_alarm" "warning_error_volume" {
alarm_name = "ldap-${var.env_name}-warning-error-count"
alarm_description = "Triggers alarm if there are more than 5 errors in the last 2 minutes"
namespace = "ldapMetrics"
metric_name = "ErrorCount"
statistic = "Sum"
period = "120"
evaluation_periods = "1"
alarm_actions = [var.sns_topic_arn]
ok_actions = [var.sns_topic_arn]
threshold = "5"
treat_missing_data = "missing"
comparison_operator = "GreaterThanThreshold"
}

resource "aws_cloudwatch_metric_alarm" "ecs_running_tasks_less_than_one" {
alarm_name = "ldap-${var.env_name}-no-running-tasks"
actions_enabled = true
Expand Down

0 comments on commit 07f2245

Please sign in to comment.