Skip to content

Commit b648f83

Browse files
committed
Added alarm to the ecs processor task
1 parent e207e02 commit b648f83

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

terraform/ecs_batch_processor_config.tf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,33 @@ resource "aws_cloudwatch_log_group" "pipe_log_group" {
357357
name = "/aws/vendedlogs/pipes/${local.short_prefix}-pipe-logs"
358358
retention_in_days = 30
359359
}
360+
361+
resource "aws_cloudwatch_log_metric_filter" "record_processor_task_error_logs" {
362+
count = var.batch_error_notifications_enabled ? 1 : 0
363+
364+
name = "${local.short_prefix}-RecordProcessorTaskErrorLogsFilter"
365+
pattern = "%ERROR:|CRITICAL:%"
366+
log_group_name = aws_cloudwatch_log_group.ecs_task_log_group.name
367+
368+
metric_transformation {
369+
name = "${local.short_prefix}-RecordProcessorTaskErrorLogs"
370+
namespace = "${local.short_prefix}-RecordProcessorTask"
371+
value = "1"
372+
}
373+
}
374+
375+
resource "aws_cloudwatch_metric_alarm" "record_processor_task_error_alarm" {
376+
count = var.batch_error_notifications_enabled ? 1 : 0
377+
378+
alarm_name = "${local.short_prefix}-record-processor-task-error"
379+
comparison_operator = "GreaterThanOrEqualToThreshold"
380+
evaluation_periods = 1
381+
metric_name = "${local.short_prefix}-RecordProcessorTaskErrorLogs"
382+
namespace = "${local.short_prefix}-RecordProcessorTask"
383+
period = 120
384+
statistic = "Sum"
385+
threshold = 1
386+
alarm_description = "This sets off an alarm for any error logs found in the record processor ECS task"
387+
alarm_actions = [aws_sns_topic.batch_processor_errors.arn]
388+
treat_missing_data = "notBreaching"
389+
}

0 commit comments

Comments
 (0)