This is the multi-page printable view of this section. .
Logs
The pg logs command displays console output logs from PostgreSQL instances and addon components (such as PgBouncer connection poolers and etcd members).
PostgreSQL Instance Logs
View recent logs
Follow logs in real-time
Show all available logs
Default behavior: Without -i, logs show the default instance.
Addon Logs
Addon logs (e.g., PgBouncer connection poolers) use the addon subcommand.
Local addons
View logs for addons attached to a local PostgreSQL instance:
Remote addons
View logs for standalone PgBouncer instances targeting remote databases:
etcd members
etcd is a top-level infra addon — select the member with --name (defaults
to etcd):
PgDog proxies
PgDog is also a top-level infra addon — select the proxy with --name
(defaults to pgdog):
PgDog logs connection-pool events (new server connections, auth, client connect/disconnect) as structured INFO lines.
HAProxy instances
HAProxy is also a top-level infra addon — select the instance with --name
(defaults to haproxy):
HAProxy logs health-check transitions (Server lb_rw/node2 is UP/DOWN, reason: ...) and connection events — useful for watching failovers live.
MinIO instances
MinIO is also a top-level infra addon — select the instance with --name
(defaults to minio):
MinIO logs to stdout: startup lines (the API: / Console: addresses it is
serving) and request errors.
Patroni members
Patroni is not an pg addon-managed component — it is a top-level pg ha
cluster — so it has its own shorthand, pg logs ha <scope> --member <name>:
pg logs ha is equivalent to pg logs addon patroni --scope <scope> --name <member>; the scope is required and the member name selects one node within
that cluster.
Patroni members log the HA loop each cycle (no action. I am (node1), a secondary, and following a leader (node3)) plus PostgreSQL startup/recovery
output — useful for spotting a stuck replica (repeating record with incorrect prev-link / waiting for WAL to become available).
Options
| Option | Short | Description |
|---|---|---|
--follow |
-f |
Follow log output (like tail -f) |
--tail N |
-n N |
Show last N lines (default: 50, use 0 for all) |
--instance NAME |
-i NAME |
Instance name (default: default) |
--pg-name NAME |
Remote addon name (for remote PgBouncer) | |
--name NAME |
etcd member / PgDog proxy / HAProxy / MinIO instance name (default: etcd / pgdog / haproxy / minio); Patroni member name (required with --scope) |
|
--scope NAME |
Patroni cluster scope (only for addon type patroni) |
|
--member NAME |
-m NAME |
Patroni member name (only for pg logs ha <scope>) |
Examples
Notes
- PostgreSQL logs include query execution, connection events, and system messages
- Addon logs show connection pooler activity (connections, disconnections, pool stats)
- etcd member logs are JSON-formatted raft/leader/peer events — useful for debugging quorum issues
- PgDog proxy logs are structured INFO lines for connection-pool events (server connections, auth, client connect/disconnect)
- HAProxy logs health-check transitions and connection events — watch a failover happen in real time
- MinIO logs startup lines and request errors to stdout
- Follow mode (
-f) keeps the connection open until interrupted with Ctrl+C - Remote addons use
--pg-nameinstead of-ito identify the target pooler; etcd members, PgDog proxies, HAProxy instances, and MinIO instances use--name