Getting started
Installation
Section titled “Installation”Download the binary for your platform (Linux / macOS, x86_64 / arm64) from GitHub Releases.
To build from source, install Rust 1.94.1 or later and run:
cargo install --git https://github.com/hideokamoto/cwsweep --lockedPrerequisites
Section titled “Prerequisites”- Run cwsweep with the credentials of the AWS Organizations management account. cwsweep does not assume a role into the management account itself; it uses your current credentials as is.
- cwsweep assumes a role into each member account. The default role name is
OrganizationAccountAccessRole, which you can override with--role-name. - Only the AWS standard partition (
aws, commercial regions) is supported. See Scope for details.
Your first scan
Section titled “Your first scan”Start with the read-only scan subcommand. scan prints log groups as a table and exits; it has no code path that can reach deletion or retention changes.
cwsweep scan --regions us-east-1,us-west-2What it looks like
Section titled “What it looks like”The screenshots below were recorded against a local fake AWS environment, so the account IDs are fictional.
scan lists every log group across all accounts and regions in one table, largest first.

clean runs as a dry-run by default. You pick the targets (nothing is pre-selected), then cwsweep prints the exact plan and skips every change.

Pass --execute to apply the plan. Each account is re-verified with STS before anything is changed.

Scan again to confirm the result. You can also set one retention period everywhere with retention set.

Subcommands
Section titled “Subcommands”| Subcommand | Purpose | Writes to AWS |
|---|---|---|
scan |
Inventory (display only) | No |
clean |
Interactively select log groups to delete or change retention | Only with --execute |
retention set |
Set the same retention period on all log groups | Only with --execute (never deletes) |
audit |
View the audit log | No (does not connect to AWS) |
Invoking cwsweep without a subcommand is an error.