Dawnfix

What your CloudWatch Logs bill is made of.

Works with AWS CloudWatch Logs PythonPython

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.

Your CloudWatch log groups are priced one by one, the costliest log line is traced to its file and line in your code, and every saving comes with its dollar figure and the command to apply it. Your log groups 3 groups · 90 GB ingested a month Each one in dollars $60.18 a month: ingestion and storage The costliest line, in your code src/api/orders.py:7 · $18.05 a month Savings, with the commands $50.55 a month · you run them
The sample: 3 log groups cost $60.18 a month, and $50.55 of it can go. Nothing is changed for you.

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 pattern query 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-policy commands.
  • Code locations: logbill locate maps the costliest patterns to file:line in 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.

$60.18a month, 3 log groups
$50.55a month in savings found
90 GBingested a month
1log group that never expires

Biggest savings

ChangeLog 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)$/monthSource
{"level":"debug","msg":"cache lookup for order <Number-1> took <Number-2> ms"}
/ecs/api-prod
$18.05src/api/orders.py:7
REPORT RequestId: <UUID-1> Duration: <Number-2> ms Billed Duration: <Number-3> ms
/aws/lambda/checkout-prod
$5.82from AWS, not your code: a logging setting
order accepted, sending confirmation to :email
/ecs/api-prod
$4.49src/api/orders.py:9

How to run it

  1. Install the CLI from PyPI. The dawnfix package (version 0.5.0, Python 3.11 or later) holds every Python tool. To build from source instead, clone dawnfix/dawnfix and run make install in its logbill/ folder:
    python3 -m venv .venv
    .venv/bin/pip install dawnfix==0.5.0
  2. 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:
    .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.json
    It shows its Logs Insights estimate and asks before that one step that costs money. It never changes retention for you: logbill fix prints the commands.
  3. 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. GetMetricData is $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 0 turns 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 pattern results, 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.