What your CloudWatch Logs bill is made of.
Works with AWS CloudWatch Logs Python
Dawnfix Logbill is a free, source-available scan that runs on your machine with your own AWS credentials, read-only. It prices every log group, finds the log lines that cost the most and where they are in your code, and puts a dollar figure on every change it suggests. Nothing is uploaded.
What the report shows
- Every log group in dollars a month: ingestion and storage at your region's prices, class (Standard, Infrequent Access), retention, filters.
- The costliest log lines: a Logs Insights
patternquery on the top groups, each pattern's share of the group's bytes and its $/month, flagged when it is DEBUG in production, Lambda START/END/REPORT or just noisy. - Retention savings: groups that never expire, with the saving at 30 and 90 days and the exact
aws logs put-retention-policycommands. - Code locations:
logbill locatemaps the costliest patterns tofile:linein your repo, so the fix is a one-line log-level change. - Infrequent Access candidates, Container Insights groups, and one headline saving that counts each dollar once.
Sample report
Made from Dawnfix Logbill's own test scenario: three made-up log groups in the AWS documentation account 123456789012, a made-up repo for the code locations. No real account. Open the full sample report, the same single HTML file the scan writes for you.
Biggest savings
| Change | Log group | $/month |
|---|---|---|
| Drop or sample a noisy log line | /ecs/api-prod | $18.05 |
| DEBUG-level lines in what looks like prod | /ecs/api-prod | $18.05 |
| Move to the Infrequent Access log class | /ecs/api-prod | $15.00 |
| Set 30-day retention (never expires today) | /ecs/api-prod | $14.55 |
| Set 90-day retention (never expires today) | /ecs/api-prod | $13.65 |
Amounts overlap (retention at 30 and 90 days, dropping a line and moving its group to Infrequent Access); the headline counts each dollar once.
Noisiest lines, and where they are in the code
| Pattern (redacted) | $/month | Source |
|---|---|---|
{"level":"debug","msg":"cache lookup for order <Number-1> took <Number-2> ms"}/ecs/api-prod | $18.05 | src/api/orders.py:7 |
REPORT RequestId: <UUID-1> Duration: <Number-2> ms Billed Duration: <Number-3> ms/aws/lambda/checkout-prod | $5.82 | from AWS, not your code: a logging setting |
order accepted, sending confirmation to :email/ecs/api-prod | $4.49 | src/api/orders.py:9 |
How to run it
- Install the CLI from PyPI. The
dawnfixpackage (version 0.5.0, Python 3.11 or later) holds every Python tool. To build from source instead, clone dawnfix/dawnfix and runmake installin itslogbill/folder:python3 -m venv .venv .venv/bin/pip install dawnfix==0.5.0 - Sign in to AWS as usual (
aws sso login --profile prod, or any profile with the policy below), then scan and map the noisy lines to your code:
It shows its Logs Insights estimate and asks before that one step that costs money. It never changes retention for you:.venv/bin/logbill scan --profile prod --regions us-east-1,eu-central-1 --out report.html .venv/bin/logbill locate --repo ../your-app --report report.jsonlogbill fixprints the commands. - Or use it from your coding agent: paste
prompts/logbill.md. The agent runs the scan, reads the JSON and sums up the top three costs.
The IAM policy it needs
Read-only: Describe calls and GetMetricData. The second statement allows the Logs Insights queries; delete it to forbid pattern analysis (groups, retention and Infrequent Access are still priced). ReadOnlyAccess covers all of it. This is logbill/iam/logbill-readonly-policy.json, verbatim:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LogbillScanReadMetadataAndMetrics",
"Effect": "Allow",
"Action": [
"logs:DescribeLogGroups",
"logs:DescribeSubscriptionFilters",
"logs:DescribeQueries",
"cloudwatch:GetMetricData"
],
"Resource": "*"
},
{
"Sid": "LogbillOptionalLogsInsightsBilledPerGBScanned",
"Effect": "Allow",
"Action": [
"logs:StartQuery",
"logs:GetQueryResults",
"logs:StopQuery"
],
"Resource": "*"
}
]
}
Applying retention yourself with logbill fix --apply needs logs:PutRetentionPolicy only (logbill/iam/logbill-apply-retention-policy.json), and asks you to type a confirmation. It is the only write Logbill can make.
What running it costs
- Metadata: free.
GetMetricDatais $0.01 per 1,000 metrics, two per log group: 500 groups is about one cent. - Logs Insights is billed per GB scanned: $0.005/GB in us-east-1, $0.005–$0.009/GB across regions; the first 5 GB a month are in the AWS free tier.
- Capped by a scan budget, 5 GB by default (
--insights-budget-gb), so at most about $0.03–$0.04. Logbill estimates each query from the group's bytes per hour, shrinks or skips queries to fit the budget, shows the estimate and asks first, and stops once the real bytes scanned reach the budget.--insights-budget-gb 0turns it off.
Privacy
- Runs locally, with your credentials. Nothing is uploaded to us or anyone; there is no telemetry and no account.
- Log lines leave AWS only as Insights
patternresults, and pass the same redactor as Dawnfix's read job (emails, phones, ids, UUIDs, tokens, query strings) before they are printed or saved. - The report is one HTML file with no external assets or links: opening it makes no network request. It holds your account id and log group names, so treat it as internal.
- This page receives nothing from the scan: it has no form, and its only script is the copy button.
After the scan
Dawnfix watches the same logs for new errors and opens a draft PR with a failing test and the fix, from your own GitHub Actions. It is free and source available too.
Set up Dawnfix (https://github.com/dawnfix/dawnfix), the source-available AI SRE, in this GitHub repo and try it once. Follow prompts/setup.md in that repo, step by step. In short: npx dawnfix init writes .dawnfix.yml and a 15-line workflow that calls dawnfix/dawnfix/.github/workflows/dawnfix.yml@v0. Then comes a read-only cloud role, then two repo settings set by name. For the local CLI, run pip install dawnfix==0.5.0. Rules: - Before you change anything (a file, a cloud role, a repo variable, a commit, a PR), tell me exactly what you will change and wait for my yes. - Least privilege: the AWS role or GCP identity must be read-only. Check the AWS role with infra/aws/verify_readonly.py from the Dawnfix repo, and stop if it fails. Never widen a policy to make it pass. - Never ask me to paste a secret into this chat, and never print one. I set my AI API key (Claude today) myself with gh secret set DAWNFIX_AI_API_KEY, and DAWNFIX_ENTERPRISE_KEY only if I have Enterprise. - Start with autonomy: diagnose in .dawnfix.yml (issues only, no code changes). Never push to the default branch; everything goes through a PR I review. - Tell me what it costs me: my own Claude tokens (on my AI API key), GitHub Actions minutes and small CloudWatch API charges. No Dawnfix key is needed. To try it, run this with my read-only credentials and show me the JSON it prints: dawnfix tick --config .dawnfix.yml --state "$(mktemp -d)/state.json" --baseline --dry-run Then open the setup PR.