daniel-cottone / serverless-es-logs

A Serverless plugin to transport logs to ElasticSearch
MIT License
54 stars 32 forks source link

Updating filterPattern to empty string in esLogs not reflected in AWS Console #491

Open vijay-singh opened 3 years ago

vijay-singh commented 3 years ago

Updating filterPattern in the esLogs block of serverless.yml does not lead to any changes actually being made to the subscription filter.

🐞 Problem I was originally using the default filterPattern but now want to specify one. My assumption was that I could just update this in serverless.yml and I'd see the change reflected in the subscription filter for the log group.

🎯 Goal Updating the subscription filter as needed when the esLogs configuration changes is expected Infrastructure-As-Code behavior. Thank you for taking a look!

vijay-singh commented 3 years ago

Dug into this some more and realized the issue only occurs if you try to pass in an empty string for the Filter Pattern -- in that case, the plugin uses the default filter pattern: https://github.com/daniel-cottone/serverless-es-logs/blob/12c35399f0c645488843b8b09889b40a053b8fe6/src/index.ts#L198

Instead I'm passing in "[event]", which leads to the expected behavior, so I'm happy to close this issue out. However, I will note that AWS supports an empty string as a filter pattern, which means to capture everything.