I am testing a cloudwatch alarm filter (to be precise checking if lambda maxed out in memory) to send to SNS which then is sent to SQS queue. However, I do not see the filter appeared in logs.
The setup is cloudwatch (filtered alarm) -> SNS -> SQS ->splunk
What I have so far:
resource "aws_cloudwatch_metric_alarm" "general_lambda_error" {
depends_on = [
"aws_cloudwatch_log_metric_filter.max_memory_time_out",
]
alarm_name = "general_lambda_error"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "Errors"
namespace = "AWS/Lambda"
period = "60"
statistic = "SampleCount"
threshold = "2"
alarm_description = "This metric monitors Lambda Memory Max Usage and other Errors: threshold=2"
alarm_actions = [ "some-arn" ]
dimensions {
FunctionName = "lambda-test"
Resource = "lambda-test"
}
}
resource "aws_cloudwatch_log_metric_filter" "max_memory_time_out" {
name = "max_memory_time_out"
pattern = "[report_name=\"REPORT\",
request_id_name=\"RequestId:\", request_id_value, duration_name=\"Duration:\", duration_value, duration_unit=\"ms\", billed_duration_name_1=\"Billed\", bill_duration_name_2=\"Duration:\", billed_duration_value, billed_duration_unit=\"ms\", memory_size_name_1=\"Memory\", memory_size_name_2=\"Size:\", memory_size_value, memory_size_unit=\"MB\", max_memory_used_name_1=\"Max\", max_memory_used_name_2=\"Memory\", max_memory_used_name_3=\"Used:\", max_memory_used_value, max_memory_used_unit=\"MB\"]"
log_group_name = "/aws/lambda/lambda-test"
metric_transformation {
name = "SampleCount"
namespace = "cloudwatch_filter"
value = "1"
}
}
How can I send the filtered message? I have found this link which describes similar problem but solution is to create a lambda function. Can I do it without creating lambda function?