Skip to content

How to create one metrics filter for multiple CloudWatch log groups?

0

I have created Lambda function testA and testB with exactly the same source code.

lambda_function.py

def lambda_handler(event, context):
    print(event)

Executing these functions will print the value of the event variable to the log groups "/aws/lambda/testA" and "/aws/lambda/testB".
I want to filter the event variable values in these logs and record them in the same metrics. How can I create a metrics filter?

asked 4 years ago3.5K views

1 Answer
2
Accepted Answer

CloudWatch metric filters are restricted to a single log group. There is not a way to set up a single metric filter to cover multiple log groups at present.

You can setup one metric filter for each log group. You can then use Metric Insights to combine those component metrics at query time for either an alarms or dashboards.

AWS

answered 4 years ago

EXPERT

reviewed 2 years ago

AWS
EXPERT

reviewed 4 years ago

  • Oh, I see, so I can only set one metrics filter per log group.

    You can setup one metric filter for each log group. You can then use Metric Insights to combine those component metrics at query time for either an alarms or dashboards.

    I will try it that way. Thank you !

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.