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.
/aws/lambda/${functionName} is more readable
There was a problem hiding this comment.
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.
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.
and what if we use /aws/lambda/${functionName}-${functionNameHash}
There was a problem hiding this comment.
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.
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.
Maybe we could add
removalPolicy:RemovalPolicy.DESTROY
There was a problem hiding this comment.
removalPolicy: RemovalPolicy.DESTROY was added to lambda and authorizer log groups
No description provided.