Skip to content
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

Merged
merged 3 commits into from
Nov 19, 2019
Merged

Cloud watch filter #11

merged 3 commits into from
Nov 19, 2019

Conversation

justinrcs
Copy link
Contributor

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.

Copy link
Contributor

@kolanos kolanos left a 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] == "*") {
Copy link
Contributor

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 ""?

Copy link
Contributor Author

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.

Copy link
Contributor

@kolanos kolanos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mrickard mrickard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kolanos kolanos merged commit 5975422 into newrelic:master Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants