Home > Net >  Set log group retention policy to never expire via clouformation
Set log group retention policy to never expire via clouformation

Time:12-07

Can I set a log group retention policy to 'never expire' using cloudformation ? F.e. I have the following template :

CustomLogGroup:
        Type: AWS::Logs::LogGroup
        Properties:
          LogGroupName: "logs"
          RetentionInDays: 3653

The documentation suggests I should use a DeleteRetentionPolicy action . Can I define/perform this action using a yml template ? If yes , how ?

CodePudding user response:

If you don't want your logs to expire, then remove the RetentionInDays property altogether:

CustomLogGroup:
        Type: AWS::Logs::LogGroup
        Properties:
          LogGroupName: "logs"

the default retention will in fact be "Never expire".

The DeleteRetentionPolicy action seems to be something you can run after the log group is created to remove whatever retention policy the log group has.

  • Related