I have a lambda that process logs from a cloudwatch log group. It saves log to Elasticsearch cluster. I am using serverless to configure the log group streaming to lambda: https://www.serverless.com/framework/docs/providers/aws/events/cloudwatch-log/.
However, it only supports listen on one log group. How can I make my lambda listen on multiple log groups? I'd like to use the pattern like:
functions:
myCloudWatchLog:
handler: myCloudWatchLog.handler
events:
- cloudwatchLog: '/aws/lambda/hello*'
In above example, I'd like my lambda to be triggered whenever there is log sent to the log group with the name start withs /aws/lambda/hello
. In this way, it will save all logs to Elasticsearch for analysis.
I can't add a wildcard on the log group, I will get this error if I add a *
An error occurred (InvalidParameterException) when calling the PutSubscriptionFilter operation: 1 validation error detected: Value '/aws/lambda/hello*' at 'logGroupName' failed to satisfy constraint: Member must satisfy regular expression pattern: [\.\-_/#A-Za-z0-9]+
- cloudwatchLog: '/aws/lambda/hello'
entries underevents
. – Noel Llevares