Configuration parameter

log_rotation_age — PostgreSQL configuration parameter

Category Error Reporting and Logging Default 24 hours Change scope Sighup

When logging_collector is enabled, this parameter determines the maximum amount of time to use an individual log file, after which a new log file will be created.

At a glance

Property Value
Parameter log_rotation_age
Category Error Reporting and Logging
Default 24
Value type integer
Change scope Reload (postgresql.conf, SIGHUP)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

When logging_collector is enabled, this parameter determines the maximum amount of time to use an individual log file, after which a new log file will be created. If this value is specified without units, it is taken as minutes. The default is 24 hours. Set to zero to disable time-based creation of new log files. This parameter can only be set in the postgresql.conf file or on the server command line.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Set it in postgresql.conf (or with ALTER SYSTEM) and reload with SELECT pg_reload_conf(); or pg_ctl reload — no restart needed.

Inspect the current value and source with SHOW log_rotation_age; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'log_rotation_age';.

Tuning guidance

Tune this for observability versus log volume, not for raw performance. More verbose logging helps diagnose problems but costs disk and I/O; quieter logging saves space but hides detail. Pick a level your log pipeline can store and search, and raise verbosity temporarily when investigating an incident.

Reference

PostgreSQL documentation — log_rotation_age.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters