Describe the bug
After the release of Advanced Logging Controls for Lambda (see https://aws.amazon.com/blogs/compute/introducing-advanced-logging-controls-for-aws-lambda-functions/) I've decided to move all the logs of my multi-stack deployment to a single unified Log Group per deployed tenant.
It goes likes this:
- The main stack creates the LogGroup like
/aws/lambda/{tenant};
- The secondary stacks refers to the LogGroup using
LogGroup.fromLogGroupArn(...);
Then I discovered that running cdk watch on the main stack I can see the cloudwatch logs on my terminal while on the secondary stacks it does not;
I found at that the cloudwatch log group resolver for the logs basically just assumes the log group is /aws/lambda/{physicalId}
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts#L114
Expected Behavior
I expect the logs to the displayed on terminal for lambda functions using pre-existing CloudWatch Log Groups not created in the stack (referred by LogGroup.fromLogGroupArn)
Current Behavior
I don't see the logs.
Reproduction Steps
Create a stack that creates a log group;
new LogGroup(this, 'tenant-log-group', {
logGroupName: `/aws/lambda/xxx`
});
On a secondary stack create a Lambda Function that uses the logGroup referred by LogGroup.fromLogGroupArn instead of creating the log group in the stack itself;
Possible Solution
Check the LoggingConfig.LogGroupName property of the lambda to resolve the CloudWatch Log Group of the Lambda
Additional Information/Context
No response
CDK CLI Version
2.131.0 (build 92b912d)
Framework Version
No response
Node.js Version
20
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
Describe the bug
After the release of Advanced Logging Controls for Lambda (see https://aws.amazon.com/blogs/compute/introducing-advanced-logging-controls-for-aws-lambda-functions/) I've decided to move all the logs of my multi-stack deployment to a single unified Log Group per deployed tenant.
It goes likes this:
/aws/lambda/{tenant};LogGroup.fromLogGroupArn(...);Then I discovered that running
cdk watchon the main stack I can see the cloudwatch logs on my terminal while on the secondary stacks it does not;I found at that the cloudwatch log group resolver for the logs basically just assumes the log group is
/aws/lambda/{physicalId}https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/api/logs/find-cloudwatch-logs.ts#L114
Expected Behavior
I expect the logs to the displayed on terminal for lambda functions using pre-existing CloudWatch Log Groups not created in the stack (referred by LogGroup.fromLogGroupArn)
Current Behavior
I don't see the logs.
Reproduction Steps
Create a stack that creates a log group;
On a secondary stack create a Lambda Function that uses the
logGroupreferred byLogGroup.fromLogGroupArninstead of creating the log group in the stack itself;Possible Solution
Check the
LoggingConfig.LogGroupNameproperty of the lambda to resolve the CloudWatch Log Group of the LambdaAdditional Information/Context
No response
CDK CLI Version
2.131.0 (build 92b912d)
Framework Version
No response
Node.js Version
20
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response