6

I have very huge log groups (770GB). I added retention of 120 days to all log groups of my account. My question is, does older logs than 120 days will be deleted? Or I have to wait 120 days?

ffedee7
  • 91
  • 1
  • 2

1 Answers1

8

I could not find in the official documentation if log retention setting is retroactive but I just have tested it and when you specify or change the log retention setting it applies retroactively, so you do not need to wait 120 days to get deleted the logs, as soon as you apply the change, it deletes all the events that match the rule (events older than 120 days)

Test

Current retention setting: 7 days (appears logs from 18/02 - one week ago)

enter image description here

Changing the log retention to 5 days:

enter image description here

Immediately get deleted events older than 5 days (logs from 18/02 are not showed now): enter image description here

Consider that log events are deleted but log streams still appears and are listed but are empty

OARP
  • 3,429
  • 1
  • 11
  • 20
  • 1
    Thanks :D I did it a few hours ago to my huge log group and didn't see its size decreased. I'll wait until tomorrow and see if it takes effect! – ffedee7 Feb 25 '21 at 19:05
  • @ffedee7 Did this work out for you? – Sero Daniel Feb 15 '22 at 23:07
  • 4
    The log groups contents appears to be deleted quite quickly, but the "Stored bytes" shown in AWS console is not updated for some time. I set retention yesterday at 15:00 on one of my log groups, and at 09:00 today it showed the same size. I just checked at 13:00 today and it now shows a much reduced size. So somewhere between 18 and 22 hours to update the size. – danio Apr 12 '22 at 11:50
  • I can second @danio's experience too. I updated a cloudwatch log group that had Indefinite retention set and had over 1TB of data in it. I updated it to 1 month yesterday and I saw that the 1TB figure was still showing, but I can only get to 1 month's worth of log streams now. Hopefully it will be reflected immediately in the retention costs. – Luke Dec 09 '22 at 16:19