serverless / serverless-plugin-log-retention

Control the retention of your serverless function's cloudwatch logs.
MIT License
21 stars 17 forks source link

Plugin no longer works with newer versions of Serverless #2

Closed DataGraham closed 5 years ago

DataGraham commented 5 years ago

As of Serverless version 1.34.1 (though probably an earlier version after 1.20.2), the key path serverless.service.resources.Resources no longer exists. The resources can now be found at serverless.service.provider.compiledCloudFormationTemplate.Resources instead.

This causes this line to create its own Resources object which is thrown out without being referenced by Serverless:

resources.Resources = nco(resources.Resources, {}); (link)

While you're at it, I would also recommend only setting the RetentionInDays property on the log group, rather than replacing the entire resource object.

Also, as of Serverless 1.26.0, logRetentionInDays is supported natively as a global option on provider, so this plugin would only be necessary to specify a different log retention policy for different functions.

tailsu commented 5 years ago

It works with 1.44.1