select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / REPORTING AND LOGGING

log_rotation_age

Read PG 18 manual ↗

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.

Type
integer
Context
sighup
Measured default
1 d
Unit
min
Metadata snapshot
18

Definition PG 18 manual

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.

Measured default history
Version intervalDefault
9.0 – 191 d
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

log_rotation_age sets the amount of time to wait before forcing log file rotation. 0 disables time-based creation of new log files. The collector opens a new file after the interval; zero disables this trigger but leaves size-based or external rotation possible.

log_rotation_age is a SIGHUP-context setting: a configuration reload activates the new server value without a restart; subsequent operations that consult it use the refreshed value.

The active path is composed from log_destination, logging_collector or syslog/eventlog, file naming and permissions, rotation triggers, and external shipping or retention.

Operational considerations

Editing log_rotation_age without reloading configuration and verifying the effective value and subsequent behavior.

Combining incompatible destination, collector, filename, and rotation assumptions and then losing or overwriting logs.

Failing to monitor a full or unwritable log target, which can block logging or database activity depending on the path.

Changing log_rotation_age globally without a rollback plan and a client or operational compatibility test.

Workload guidance

OLAP: Long analytical bursts do not require a different clock by themselves; choose an interval that lets downstream systems close and ingest files predictably without producing impractically large objects.

OLTP: Set log_rotation_age from the maximum time a file may remain open and the shipping/retention boundary. Confirm that the filename pattern creates a distinct or intentionally reusable name at that interval.

SMALL: Prefer a simple daily or shorter interval that keeps failure blast radius bounded. Zero disables time rotation and is safe only when size-based or external rotation is authoritative and tested.

Version history 3
  1. PG 17 → 18changed
  2. PG 14 → 15changed
  3. PG 11 → 12changed

Related entries

Further reading

Definition snapshot: english-manuals:a6eff496cc23fe4d4ec5484c70f… · English manual source