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
--dbnameflag and its argument. The log prefix'%m [%p] 'does not include the database name, sopgbadger, presumably, is unable to find any statements logged against the provided database name and reports accordingly.The solution is to either not pass
--dbnameor modify the log prefix inpostgresql.confto 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.