Parameter · Reporting and Logging / Where to Log
log_directory
Sets the destination directory for log files. Can be specified as relative to the data directory or as absolute path.
- Default:
log - Type: string
- Applies: Reload
In plain words
The folder where the logging collector puts its files. A relative path such as the default log means $PGDATA/log; you can also give an absolute path, for example a separate disk.
For DBAs and operators
Used only when logging_collector is on. The directory is created at startup if missing (the server user needs permission on the parent). Changing it with a reload makes the logger switch to a new file in the new place.
Putting logs outside $PGDATA has two benefits: a runaway log (say log_statement = all) cannot fill the data volume and stop the database, and base backups do not carry gigabytes of old logs (pg_basebackup copies the log/ directory inside $PGDATA like any other file; verified on 18.6).
SHOW log_directory;
SELECT pg_current_logfile(); -- e.g. log/postgresql-2026-10-22_000000.log
SELECT * FROM pg_ls_logdir() ORDER BY modification DESC LIMIT 5;pg_ls_logdir() needs superuser or the pg_monitor role. In a support case, also check $PGDATA/current_logfiles, which the logger rewrites on every rotation.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().