When run with this command, pgbadger finds no queries, even though there are slow queries logged in the database log.
pgbadger --dbname foo /path/to/logfile --format stderr --prefix '%m [%p] '
Example log entry
2020-04-08 07:58:42.014 BST [1505890] LOG: duration: 119.079 ms statement: SELECT "bar".id FROM "bar" WHERE (("bar"."baz" = 0.0) AND ("bar"."quux" = 0.0)) ORDER BY "bar"."id"
The problem was passing the --dbname
flag and its argument. The log prefix '%m [%p] '
does not include the database name, so pgbadger
, presumably, is unable to find any statements logged against the provided database name and reports accordingly.
The solution is to either not pass --dbname
or modify the log prefix in postgresql.conf
to include the database name (for example '%m [%p] %d '
), reload the server config and wait for new entries in the log.
I found this on an Openstack Fedora vm, where '%m [%p] '
was the default log prefix.