-
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
[lambda][logs] Make LogRetention construct reusable for any log group not just Lambda's #9671
Comments
We currently don't have higher level construct support for sagemaker. This makes sense to implement something like this when we build that there. @humanzz - do you have a wishlist (besides sagemaker) where this would be useful? |
The point is, I'm trying to separate the 2 things
The usage of 1 need not be coupled with other higher level constructs. For instance, we use Glue... and Glue creates a central non Glue job specific glue that we'd also like to set retention on. In terms of the immediate services we have in mind; Lambda ✅ , SageMaker, AWS Chatbot where we're also considering contributing a higher level construct for AWS Chatbot has an interesting aspect to it though because it's a global service that puts its logs in So in our mind we had a plan a long the lines of
|
@humanzz the It's currently used in aws-cdk/packages/@aws-cdk/aws-rds/lib/instance.ts Lines 573 to 578 in 4bc8188
|
@jogold Thanks for pointing that out. My initial scan of the provider code drove me to the wrong conclusion as I thought the implementation is Lambda-specific
The other thing we might try to contribute to (if we figure this out properly) is updating the construct to allow for cross-region log retention setting for the case I described above for Global AWS regions that create logs in Maybe we can repurpose this issue for that? |
@jogold - you're right that it is reusable. However, it creates a dependency on the If we switch the implementation to use @eladb - what do you think?
@humanzz - since this is an orthogonal request, would be nice to open a separate issue and track this separately. Could you do that? |
@nija-at sure. |
Feels like this should be in the |
We'll work on #9703 first (likely a non-breaking change). We can then work on this one (moving the construct which is a breaking change) unless you plan to do it soon. |
This will have to be a non-breaking change as well. (Suggested ordering) might make sense to move this before making the change to support global AWS services, given that lambda is not one of the global AWS services. |
@nija-at I think our preference is to do the other change first since it's a smaller one. |
@nija-at given i'll be off the next couple of days, I wanted to leave a draft PR so you can have some initial comments on it. I'll be addressing them on Monday
|
…9808) move LogRetention construct definition from lambda to logs while refactoring it so it does not depend on lambda constructs this required reimplementing the functionality provided by lambda.SingletonFunction using CfnResource keep declared classes/interfaces in lambda for compatability while marking them as deprecated they should be removed in an upcoming breaking change for their current customers in lambda and rds Fixes #9671
Various AWS resources autocreate log groups if they don't exist e.g. Lambda functions, SageMaker Endpoints.
For a while, my team have managed to create log groups explicitly for lambda functions to customize the log retention policies. This worked well because Lambda didn't attempt to create the log groups until the first request. However, I believe that with recent changes over the past year in Lambda (VPC improvements, Provisioned Concurrency), log groups can be created before the first request which makes our approach slightly problematic.
We noticed the introduction of LogRetention construct and log retention props for Lambda functions that utilize it to let the function create the log group and have a custom resource that manages setting the retention policy.
We think that the LogRetention construct can be reused outside of just Lambda functions e.g. SageMaker Endpoints.
This is a feature request to update LogsRetention construct and the provider it uses to make them reusable for non-Lambda function log groups.
Use Case
Enable using the LogRetention construct for any AWS resource that auocreates logs to manage those logs retention.
Out of scope is introducing different props to different resource constructs to add that support. That can come in later changes.
As my team might be able to contribute to this work, we're asking for feedback on this approach. If you think it's sensible, then one of the questions we have is about the location of this construct (it's currently part of the lambda module) but if it's to become general purpose, it probably should go somewhere else e.g. the logs module.
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: