Skip to content

Conversation

@robrat
Copy link
Contributor

@robrat robrat commented Aug 4, 2025

No description provided.


const logGroup = new aws_logs.LogGroup(stack, `LogGroup${functionNameHash}`, {
retention: aws_logs.RetentionDays.TWO_WEEKS,
logGroupName: `/aws/lambda/${functionNameHash}`,
Copy link
Owner

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Owner

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}

Copy link
Contributor Author

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.


const logGroup = new aws_logs.LogGroup(stack, `LogGroup${functionNameHash}`, {
retention: aws_logs.RetentionDays.TWO_WEEKS,
logGroupName: `/aws/lambda/${functionNameHash}`,
Copy link
Owner

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}`,
Copy link
Owner

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

Copy link
Contributor Author

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

@clebert clebert enabled auto-merge August 14, 2025 11:36
@clebert clebert merged commit 092a523 into clebert:master Aug 14, 2025
1 check passed
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.

2 participants