Share a pgBadger report
pgBadger answers the question every Postgres performance conversation starts with — which queries are actually costing you — and it answers it on the database host, where the people who wrote those queries do not have accounts.
So the report gets read by one person, who screenshots the top-ten table into a channel, and the application team receives a cropped image of a normalized query and is asked to do something about it.
Publish it
pgbadger --anonymize -o pgbadger.html \
/var/log/postgresql/postgresql-*.log
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html pgbadger.html \
--arg title "Postgres — $DB — week $(date +%V)" \
'{title: $title, html: $html}')"
Or drag pgbadger.html into the app. The
charts and sortable tables keep working — scripts run inside a sandboxed
iframe (allow-scripts, no allow-same-origin).
Treat it as sensitive
Query text reveals schema and business logic even after normalization,
and logs configured with log_statement = 'all' can contain literal
parameter values. --anonymize helps. Reports are private by default
and access is per report — keep database reports team-visible at most.
See the sharing model, and use a
scoped token with reports:write only.
What the URL changes
- The slow query gets a thread. "This is the export job, we can move it off-peak" pinned to the query row, where the application team will see it. See commenting on HTML.
- A weekly trend. Revision per run at one URL. See revisions and diffs.
- The DBA and the app team read the same page instead of two screenshots of it.
- On a schedule. A routine regenerates it weekly — see weekly digests.
Limits
- HTML body: 5 MB. A month of logs from a busy instance produces a
much larger report; narrow the period with
--begin/--end, or publish weekly reports rather than one enormous one. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- Profiling reports — the application side
- SchemaSpy docs · Benchmark reports
- Weekly digests · Routines