diff --git a/aws/common/cloudwatch_queries.tf b/aws/common/cloudwatch_queries.tf new file mode 100644 index 000000000..47035733a --- /dev/null +++ b/aws/common/cloudwatch_queries.tf @@ -0,0 +1,118 @@ +resource "aws_cloudwatch_query_definition" "sms-sns-blocked-as-spam" { + count = var.cloudwatch_enabled ? 1 : 0 + name = "SMS (SNS) / Block as spam" + + log_group_names = [ + aws_cloudwatch_log_group.sns_deliveries_failures[0].name + ] + + query_string = <[^"]+)"/ +| parse @message /"eventType":"(?[^"]+)"/ +| parse @message /"isFinal":(?\w+)/ +| filter Is_Final = "true" +| stats count(*) as Event_Count by Country, Event_Type +| display Country, Event_Type, Event_Count +| sort Country asc +| limit 100 +QUERY +} + +resource "aws_cloudwatch_query_definition" "pinpoint-sms-get-sms-logs-by-dest-phone-number" { + count = var.cloudwatch_enabled ? 1 : 0 + name = "SMS (Pinpoint) / Get SMS logs by destination phone number" + + log_group_names = [ + aws_cloudwatch_log_group.pinpoint_deliveries[0].name, + aws_cloudwatch_log_group.pinpoint_deliveries_failures[0].name + ] + + query_string = <