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

[lambda] Expose function's log group as property #4348

Closed
1 task done
Shahab96 opened this issue Oct 2, 2019 · 3 comments
Closed
1 task done

[lambda] Expose function's log group as property #4348

Shahab96 opened this issue Oct 2, 2019 · 3 comments
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda feature-request A feature should be added or improved.

Comments

@Shahab96
Copy link

Shahab96 commented Oct 2, 2019

Exposing the log group created by cdk for a lambda function as a property.

Use Case

When making metrics to monitor lambda memory consumption, the only way to do it currently is by using a metric filter on the cloudwatch logs. However the metric filter requires a log group object to apply the filter on and in order to get the log group object currently, we need to parse the arn of the generated log group and use that to capture the ILogGroup object which we would use to apply metric filters.

Proposed Solution

Expose the log group that cdk creates for the lambda function as a property

Proposed solution:

public logGroup: ILogGroup;
constructor(scope: Construct, id: string, props: FunctionProps) {
    ...
    this.logGroup = logs.LogGroup.fromLogGroupArn(scope, id, parsedLogGroupArn);
}

Expected result:

const func = new lambda.Function(...someArgumentsHere);
const logGroup = func.logGroup;

Other

  • 👋 I may be able to implement this feature request

This is a 🚀 Feature Request

@Shahab96 Shahab96 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 2, 2019
@NGL321 NGL321 added @aws-cdk/aws-lambda Related to AWS Lambda and removed needs-triage This issue or PR still needs to be triaged. labels Oct 3, 2019
@NGL321
Copy link
Contributor

NGL321 commented Oct 3, 2019

Hey @Shahab96,

Thank you for commenting! This seems like a reasonable feature request. We can definitely look into it, however if you would like to see this fast, your best bet is submitting a PR yourself!

Either way, someone will comment here to let you know when there is an update!

😸

@nija-at nija-at changed the title Expose lambda function log group as property [lambda] Expose function's log group as property Oct 18, 2019
@nija-at
Copy link
Contributor

nija-at commented Oct 18, 2019

Related #667 & #3838

@nija-at
Copy link
Contributor

nija-at commented Oct 18, 2019

Duplicate of #3838

@nija-at nija-at marked this as a duplicate of #3838 Oct 18, 2019
@nija-at nija-at closed this as completed Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants