-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud watch filter #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution @justinrcs. It's definitely a feature we've been meaning to add. Only question is relating to the catch-all filter option.
src/index.ts
Outdated
@@ -75,6 +75,18 @@ export default class NewRelicLambdaLayerPlugin { | |||
|
|||
public async addLogSubscriptions() { | |||
const funcs = this.functions; | |||
let { cloudWatchFilter = [ "NR_LAMBDA_MONITORING" ] } = this.config; | |||
|
|||
if(cloudWatchFilter.length == 1 && cloudWatchFilter[0] == "*") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete the first item here? Wouldn't it be better to iterate over the array looking for *
and if found just set the filter pattern to ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thinking here was if you wanted all the logs, you wouldn't provide a list of filters, just the one. i will make the change as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Add optional configuration to specify a custom filter for the CloudWatch log subscription.
Configuration defaults to the standard "NR_LAMBDA_MONITORING" filter.
If the filter is configured as "*" it will capture all logs.
If multiple filters are provided they are combined into an OR filter.