File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -301,3 +301,29 @@ resource "aws_lambda_event_source_mapping" "batch_file_created_sqs_to_lambda" {
301301 batch_size = 1
302302 enabled = true
303303}
304+
305+ resource "aws_cloudwatch_log_metric_filter" "batch_processor_filter_error_logs" {
306+ name = " ${ local . short_prefix } -BatchProcessorFilterErrorLogsFilter"
307+ pattern = " %\\ [ERROR\\ ]|\\ [CRITICAL\\ ]%"
308+ log_group_name = aws_cloudwatch_log_group. batch_processor_filter_lambda_log_group . name
309+
310+ metric_transformation {
311+ name = " ${ local . short_prefix } -BatchProcessorFilterErrorLogs"
312+ namespace = " ${ local . short_prefix } -BatchProcessorFilterLambda"
313+ value = " 1"
314+ }
315+ }
316+
317+ resource "aws_cloudwatch_metric_alarm" "batch_processor_filter_error_alarm" {
318+ alarm_name = " ${ local . short_prefix } -batch-processor-filter-lambda-error"
319+ comparison_operator = " GreaterThanOrEqualToThreshold"
320+ evaluation_periods = 1
321+ metric_name = " ${ local . short_prefix } -BatchProcessorFilterErrorLogs"
322+ namespace = " ${ local . short_prefix } -BatchProcessorFilterLambda"
323+ period = 120
324+ statistic = " Sum"
325+ threshold = 1
326+ alarm_description = " This sets off an alarm for any error logs found in the batch processor filter Lambda function"
327+ alarm_actions = [aws_sns_topic . batch_processor_errors . arn ]
328+ treat_missing_data = " notBreaching"
329+ }
Original file line number Diff line number Diff line change @@ -337,8 +337,8 @@ resource "aws_cloudwatch_metric_alarm" "file_name_processor_error_alarm" {
337337 evaluation_periods = 1
338338 metric_name = " ${ local . short_prefix } -FilenameProcessorErrorLogs"
339339 namespace = " ${ local . short_prefix } -FilenameProcessorLambda"
340- period = 60
341- statistic = " Count "
340+ period = 120
341+ statistic = " Sum "
342342 threshold = 1
343343 alarm_description = " This sets off an alarm for any error logs found in the file name processor Lambda function"
344344 alarm_actions = [aws_sns_topic . batch_processor_errors . arn ]
You can’t perform that action at this time.
0 commit comments