Skip to content

Getting started

How to use cwsweep (2-minute walkthrough)

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:

Terminal window
cargo install --git https://github.com/hideokamoto/cwsweep --locked
  • 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.

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.

Terminal window
cwsweep scan --regions us-east-1,us-west-2

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.

scan output: a table of account ID, region, log group, stored bytes and retention for 11 log groups

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.

clean in dry-run mode: the selected log groups, the planned delete actions, and “skipped (dry-run: –execute not supplied)” for each

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

clean with –execute: the same plan applied, with “success” reported for each log group

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

scan after cleaning: the deleted log groups no longer appear in the table

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.

Privacy Policy