DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Reporting and Logging / Where to Log

syslog_facility

Sets the syslog "facility" to be used when syslog enabled.

  • Default: local0
  • Type: enum
  • Values: local0 · local1 · local2 · local3 · local4 · local5 · local6 · local7
  • Applies: Reload

In plain words

When PostgreSQL logs to syslog, each message is tagged with a facility, a category the syslog daemon uses to route messages to files. PostgreSQL uses one of the eight "local" facilities reserved for applications; pick the one your syslog rules expect.

For DBAs and operators

Only used when log_destination contains syslog. PostgreSQL also maps its severities onto syslog priorities, so the daemon can filter by level. On a capture of the raw datagrams with the default LOCAL0, LOG lines arrived as <134> (local0.info) and ERROR lines as <132> (local0.warning): PostgreSQL ERROR maps to syslog WARNING, FATAL/PANIC map to ERR/CRIT, DEBUG to DEBUG, LOG/INFO to INFO, and both NOTICE and WARNING to NOTICE.

Matching rsyslog rule:

# /etc/rsyslog.d/postgresql.conf
local0.*    -/var/log/postgresql/postgresql.log
& stop

Without the stop, the same lines usually also land in /var/log/syslog or /var/log/messages. With systemd-journald the facility is kept as a field: journalctl SYSLOG_FACILITY=16 (local0 = 16, local1 = 17 …).

Syslog is lossy under pressure (UDP or a full socket buffer) and messages are split at about 900 bytes (syslog_split_messages), so for detailed troubleshooting the logging collector is more reliable.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Logger (logging collector)

Related parameters

log_destination syslog_ident syslog_sequence_numbers syslog_split_messages

All Reporting and Logging parameters