I found a weird instance of my global log retentio...
# help
s
I found a weird instance of my global log retention setting being disregarded for some reason in my
main()
, I have this:
Copy code
app.setDefaultFunctionProps(stack => ({
    // ...
    logRetention:
      app.stage === 'prod'
        ? logs.RetentionDays.THREE_MONTHS
        : logs.RetentionDays.FIVE_DAYS,
and yet, this one slipped through the cracks
the only thing I see special about it compared to the other functions is that it’s defined as part of a Step Function task:
Copy code
const transcodeTask = new tasks.LambdaInvoke(stack, 'Transcode Track', {
    comment: 'Transcodes an audio track',
    lambdaFunction: new sst.Function(stack, 'TranscodeAudioFunc', {
yep, that’s it. if I create the function separately, then the log retention is as expected
I had to rename the function to avoid an error (the function already exists). oddly enough, CDK didn’t clean up and left me with the old function
f
Oh that’s really weird. Is this happening to all the functions in the step function workflow?
s
hmm. I guess I was wrong. there are other tasks where the function is defined inside, and the log retention is what I’d expect
weird. not sure why that one didn’t get set
f
did the log retention look fine after redeploying it?
s
when I separated the function declaration from the task, yeah. but now that I think about it, that may have had nothing to do with it. hard to say why it happened
but it did happen consistently on two AWS accounts, so it wasn’t a glitch
f
oh i see. Was it always the same function?
s
yeah
if I run into it again or manage to replicate it, I’ll let you know
f
j
@Sam Hulick Did it happen again ? Were you able to replicate the issue ?
s
not really sure. I just manually set the retention period in the AWS console and moved on 🙂