Skip to content

pgbadger

Graham Christensen edited this page Jan 16, 2022 · 6 revisions

Assuming your local machine is on the wireguard network...

On haumea, run:

journalctl --output=short-iso -u postgresql | zstd -9 | pv | socat - TCP4-LISTEN:10050,so-bindtodevice=wg0,reuseaddr

On your local machine, run:

pgbadger --journalctl 'xfer() { nc -N 10.254.1.9 10050 < /dev/null | zstd -d | pv; }; xfer' --prefix "%t\+\d+ .*[%p]: user=%u,db=%d,app=%a,client=%h "

Note the bizarre --journalctl argument is to deal with pgbadger passing --output=short-iso to the command. If it isn't working correctly, try removing the xfer() { ... }; xfer wrapper and see what arguments it is passing.

Clone this wiki locally