> ## Documentation Index
> Fetch the complete documentation index at: https://help.nops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Idle CloudWatch Log Group

> Delete CloudWatch log groups that have received no new logs in 30 days, or set a retention period on them.

CloudWatch Logs bills every month for stored log data, and log groups keep data forever unless a retention period is set. When the application or function that wrote to a log group is gone, the stored logs keep costing money. nOps finds log groups that still store data but have received nothing for 30 days, and shows their storage charge as the saving.

| | |
| - | - |
| **Cloud** | AWS |
| **Category** | Storage |
| **Service** | Amazon CloudWatch |
| **Action** | Delete |
| **Effort** | Low |
| **Restart needed** | No |
| **Can be rolled back** | No |
| **Analysis window** | Last 30 days |
| **Source** | nOps |

## 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

1. Confirm nothing writes to the log group any more and nobody needs its old logs for audits or investigations.
2. If the logs must be kept, export them to S3 first (**CloudWatch → Log groups → Actions → Export data to Amazon S3**).
3. 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`).
4. 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.

## Related

* [Set CloudWatch Logs Retention](https://help.nops.io/inform/supported-recommendations/set-cloudwatch-logs-retention)
* [Move CloudWatch Log Group to Infrequent Access Class](https://help.nops.io/inform/supported-recommendations/move-cloudwatch-log-group-to-infrequent-access-class)
* [Enable CloudWatch Logs Intelligent Tiering](https://help.nops.io/inform/supported-recommendations/enable-cloudwatch-logs-intelligent-tiering)
* [Supported recommendations](https://help.nops.io/inform/supported-recommendations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.