Parameter · Reporting and Logging / Where to Log
log_destination
Sets the destination for server log output. Valid values are combinations of "stderr", "syslog", "csvlog", "jsonlog", and "eventlog", depending on the platform.
- Default:
stderr - Type: string
- Applies: Reload
In plain words
PostgreSQL writes a stream of messages (errors, warnings, connections, slow queries). log_destination chooses where that stream goes: plain text on stderr, structured CSV or JSON files, the operating system's syslog, or the Windows Event Log.
You can list several at once, for example 'stderr,jsonlog', and every message is written to each of them.
For DBAs and operators
Valid values: stderr, csvlog, jsonlog (PostgreSQL 15+), syslog, and eventlog (Windows only). csvlog and jsonlog require logging_collector = on; the collector then writes .csv / .json files next to the .log file, with the same base name from log_filename.
The same error in each format (captured on 18.6):
2026-10-22 15:38:02.293 UTC [5977] ERROR: division by zero2026-10-22 15:38:02.293 UTC,"postgres","postgres",5977,"[local]",6ada2dda.1759,1,"SELECT",2026-10-22 15:38:02 UTC,0/3,0,ERROR,22012,"division by zero",,,,,,"select 1/0",,,"psql","client backend",,0{"timestamp":"2026-10-22 15:38:02.293 UTC","user":"postgres","dbname":"postgres","pid":5977,"remote_host":"[local]","session_id":"6ada2dda.1759","line_num":1,"ps":"SELECT",…,"error_severity":"ERROR","state_code":"22012","message":"division by zero","statement":"select 1/0","application_name":"psql","backend_type":"client backend","query_id":0}CSV and JSON ignore log_line_prefix: every field is always present, which makes them ideal for loading into a table or a log pipeline. Find the current files with:
SELECT pg_current_logfile(), pg_current_logfile('csvlog'), pg_current_logfile('jsonlog');
-- also written to $PGDATA/current_logfilesSupport tip: with plain stderr and no collector, the log goes wherever the postmaster's stderr points (the pg_ctl -l file, or the systemd journal). Debian/Ubuntu packages use their own wrapper and write to /var/log/postgresql/. Always ask "where does stderr go?" before hunting for a log.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().
See it in context
Related parameters
logging_collector log_directory log_filename syslog_facility event_source log_line_prefix