Why it matters
Log groups are created with no retention by default, so their storage grows every month and is rarely reviewed.How nOps finds it
nOps flags a log group when its stored data grew in each of the last three 30-day periods and never shrank, so its events are kept indefinitely or for more than 90 days. The saving is the storage billed for data older than the recommended retention period, at the log group’s billed storage rate.Before you start
Check audit, security and compliance requirements for how long the logs must be kept. Permission to set retention (logs:PutRetentionPolicy).
How to implement
- Confirm how long the logs must be kept, and export older events to S3 first if they must be kept longer.
- Check the current setting (
aws logs describe-log-groups --log-group-name-prefix LOG_GROUP); no retentionInDays means never expire. - Set the retention period (CloudWatch console: Log groups → your group → Actions → Edit retention setting, or
aws logs put-retention-policy --log-group-name LOG_GROUP --retention-in-days 90). - Set retention in Terraform, CloudFormation or the code that creates the group, so new groups get it too.
Risks and considerations
- Events older than the retention period are deleted permanently, within about 72 hours.
- If you also enable Intelligent Tiering, retention saves less, because old data is already billed at a lower rate. Do not add the two savings together.
- To undo, remove the retention policy (
aws logs delete-retention-policy). Events already deleted cannot be restored.
FAQs
Why 90 days?
Why 90 days?
It is the default nOps suggests. Choose the period your compliance rules require; a longer period saves less.