-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(core): custom resources deprecate logRetention
in favor of logGroup
#28783
Conversation
…avor of `logGroup` See #28737 for full details. Some custom resources have made the `logRetention` property part of their own API. In these cases, we are now also deprecating `logRetention`. Migrating log groups for custom resource would follow the same steps as outline in #28737. Given that custom resource logging is for debugging purposes and there are no guarantees about the output format, it should be possible to simply replace `logRetention` with a simple `logGroup` in most cases: ```ts const awsCustom1 = new cr.AwsCustomResource(this, 'API1', { // Replace this logRetention: logs.RetentionDays.ONE_WEEK, // with logGroup: new logs.LogGroup(this, 'AwsCustomResourceLogs', { retention: logs.RetentionDays.ONE_WEEK, }), }); ```
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
logRetention
properties in favor of logGroup
logRetention
in favor of logGroup
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 am also surprised by lack of tests -- is the behavior already being tested elsewhere?
Yes But you're right. I need to update a few tests. |
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
@kaizencc Added tests. Hope that satisfies your standards 😅 |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
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.
Yay :)
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
### Issue Closes #28919 ### Reason for this change In #28737 and #28783 we have deprecated various `logRetention` properties in favor of the new Logging Configuration feature for Lambda Functions. This new feature provides full control over the Lambda Function log group via the `logGroup` property. However Logging Configuration is not available yet for all regions. Particularly GovCloud and CN regions (at the time this issue was created). For customers in of these regions there is currently no clear migration path. We therefore revert the deprecation of previously deprecated properties. ### Description of changes Revert the deprecation of previously deprecated `logRetention` properties. Update documentation to be more explicit about the various options customers have. ### Description of how you validated changes Documentation & annotation change only. This is a partial revert of the PRs linked about, with minor documentation updates. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
### Issue Closes #28919 ### Reason for this change In #28737 and #28783 we have deprecated various `logRetention` properties in favor of the new Logging Configuration feature for Lambda Functions. This new feature provides full control over the Lambda Function log group via the `logGroup` property. However Logging Configuration is not available yet for all regions. Particularly GovCloud and CN regions (at the time this issue was created). For customers in of these regions there is currently no clear migration path. We therefore revert the deprecation of previously deprecated properties. ### Description of changes Revert the deprecation of previously deprecated `logRetention` properties. Update documentation to be more explicit about the various options customers have. ### Description of how you validated changes Documentation & annotation change only. This is a partial revert of the PRs linked about, with minor documentation updates. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@mrgrain Any solution or workaround to this yet? I am still getting this error. Specific issue that I am getting is given in #28809 I didn't understand what to do based on [WARNING] aws-cdk-lib.aws_lambda.FunctionOptions#logRetention is deprecated. In AWS CDK code, you can access the log group name directly from the LogGroup construct: declare const myLogGroup: logs.LogGroup; |
@saurabhmarwaha This was originally fixed in v2.123.0 and the deprecation was later reverted in v2.125.0. Please update your version of |
In #28737 we have deprecated
logRetention
in favor oflogGroup
. Some custom resources have made thelogRetention
property part of their own API and are now emitting deprecation warnings with no way forward to resolve them. So we are now also deprecatinglogRetention
for any custom resources.Migrating log groups for custom resource would follow the same steps as outline in #28737. Given that custom resource logging is for debugging purposes and there are no guarantees about the output format, it should be possible to simply replace
logRetention
with a simplelogGroup
in most cases:Fixes #28806
Fixes #28809
Related to #28737
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license