-
Notifications
You must be signed in to change notification settings - Fork 9
fix deprecated cdk log retention #184
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
fix deprecated cdk log retention #184
Conversation
src/cdk/create-request-authorizer.ts
Outdated
|
|
||
| const logGroup = new aws_logs.LogGroup(stack, `LogGroup${functionNameHash}`, { | ||
| retention: aws_logs.RetentionDays.TWO_WEEKS, | ||
| logGroupName: `/aws/lambda/${functionNameHash}`, |
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.
/aws/lambda/${functionName} is more readable
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.
I kept the hash in the name because the previous version were generating log groups like /aws/lambda/GET-Cms-Victor-Bff-Integrator-Lambda-v1-3-4-c9f3c15 and /aws/lambda/aws-simple-request-authorizer-965d7ef.
For the request authorizer I'm not sure how the stacks behave / if it would confuse people if the aws account has multiple deployments and all authorizer log data is going to the same log group.
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.
But for the other lambda functions it should be safe to omit the hash since the name contains the version
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.
and what if we use /aws/lambda/${functionName}-${functionNameHash}
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.
Sorry, I was wrong in my comment. functionName already has a hash at the end which is constructed of domain parts, so this should not cause any collisions / problems. Changed as suggested.
src/cdk/create-request-authorizer.ts
Outdated
|
|
||
| const logGroup = new aws_logs.LogGroup(stack, `LogGroup${functionNameHash}`, { | ||
| retention: aws_logs.RetentionDays.TWO_WEEKS, | ||
| logGroupName: `/aws/lambda/${functionNameHash}`, |
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.
and what if we use /aws/lambda/${functionName}-${functionNameHash}
| const fn = new aws_lambda.Function(stack, `Function${getHash(uniqueFunctionName)}`, { | ||
| const logGroup = new aws_logs.LogGroup(stack, `LogGroup${uniqueFunctionNameHash}`, { | ||
| retention: aws_logs.RetentionDays.TWO_WEEKS, | ||
| logGroupName: `/aws/lambda/${uniqueFunctionName}`, |
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.
Maybe we could add
removalPolicy:RemovalPolicy.DESTROY
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.
removalPolicy: RemovalPolicy.DESTROY was added to lambda and authorizer log groups
No description provided.