Parameter · Reporting and Logging / Where to Log
logging_collector
Start a subprocess to capture stderr, csvlog and/or jsonlog into log files.
- Default:
off - Type: bool
- Applies: Restart required
In plain words
With logging_collector on, PostgreSQL starts a small extra process, the logger, that collects everything the other processes write and stores it in files under log_directory, starting new files on a schedule.
With it off (the default), messages just go to wherever the server's standard error goes, which depends on how it was started. CSV and JSON logs need it on.
For DBAs and operators
When on, the postmaster creates a pipe, points every child's stderr at it, and forks the logger process (visible as postgres: logger in ps; it does not appear in pg_stat_activity). At startup the postmaster prints, to the original stderr:
Only the collector honours log_directory, log_filename, log_rotation_age, log_rotation_size, log_truncate_on_rotation and log_file_mode. It also captures stderr output that does not come from PostgreSQL's own logging (dynamic linker errors, crash output from libraries), which syslog would miss.
Design choice: the collector never drops messages. If it cannot keep up (very verbose logging on slow storage), backends block while writing to the pipe, so heavy logging can slow down queries. syslog takes the opposite trade-off and may lose lines.
Rotate on demand with SELECT pg_rotate_logfile(); or pg_ctl logrotate. Many packaged installs (RPM/PGDG) ship with the collector on; Debian/Ubuntu leave it off and redirect stderr to /var/log/postgresql/postgresql-18-main.log via pg_ctlcluster.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Related parameters
log_destination log_directory log_filename log_rotation_age log_rotation_size