Heya! Can we set log retention policies on the de...
# help
t
Heya! Can we set log retention policies on the debug stack? I'm not seeing a way, but maybe I'm missing something. I'm just trying to get rid of all the "never expire" logs. Thanks!!
For the main stack, we can do...
Copy code
app.setDefaultFunctionProps({
    logRetention: RetentionDays.ONE_WEEK,
  });
...but it's not valid for the debug stack.
f
Hey @Tim V, sorry about the delay in the response. The log retention for Lambda functions in the debug stack should default to 1 week.
Could it be you are using an older version?
t
Could be. I just see logs with Never Expire and I'm trying to eliminate them. I'll come back to this with more information when I can!
f
Btw, pinning pins for the entire channel lol Maybe save item is what u were looking for 🤣
t
OH... I didn't realize it was a channel-wide pin!
@Frank I'll DM you some example logs.
f
Thanks @Tim V. To add some context,
app.setDefaultFunctionProps
sets the log retention for Lambda function we explicitly created in the SST app, ie. Api routes.
The log groups in your screenshot that do not have retention set are from Custom Resources.
There isn’t a good way to set log retentions for these Lambda functions. The reason being, when u set log retentions, behind the scene CDK has to create a custom resource to set it. But that custom resource will in turn create a new Lambda function. And that new function has Never expire retention.
Let me know if that makes sense.
We should definitely find a better to set retention for all function. Let me an issue to track this https://github.com/serverless-stack/serverless-stack/issues/1627
t
Thanks, Frank. That makes sense enough for me right now. 🙂