Why it matters
Log groups from deleted Lambda functions, old deployments and test runs pile up and keep billing for storage nobody reads.How nOps finds it
nOps reads the last 30 days of CloudWatch Logs billing. A log group is flagged when its storage was billed since before the 30-day window and in the last 2 days, and it had no ingestion of any kind (standard, vended or Infrequent Access) in the window. The saving is its storage charge over the last 7 days, scaled to a month, and must be at least $2 a month.Before you start
Permission to delete log groups or set retention (logs:DeleteLogGroup, logs:PutRetentionPolicy).
How to implement
- Confirm nothing writes to the log group any more and nobody needs its old logs for audits or investigations.
- If the logs must be kept, export them to S3 first (CloudWatch → Log groups → Actions → Export data to Amazon S3).
- Delete the log group (
aws logs delete-log-group --log-group-name NAME), or set a retention period so old data expires (aws logs put-retention-policy --log-group-name NAME --retention-in-days DAYS). - Remove it from Terraform or CloudFormation, or set the retention there.
Risks and considerations
- Deleting a log group deletes all its logs permanently.
- If the service that wrote to it starts again, it may recreate the log group with no retention period.