Skip to content

log_rotation_age

log_rotation_age is the PostgreSQL setting that defines the amount of time to wait before forcing log file rotation.
Note

Fact — official short description: “Sets the amount of time to wait before forcing log file rotation.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , Valuemin
Raw unit
Range , Value035791394
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueReporting and Logging / Where to Log
Upstream classification
Latest boot value , Value1440
1 d

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 1440 min 1 d

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.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
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.
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.
Small nodes 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.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP 1d same as boot '1d'
OLAP 1d same as boot '1d'
CRIT 1d same as boot '1d'
TINY 1d same as boot '1d'
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 1d (dcs); OLAP: PG9.0–19 Beta 3 = 1d (dcs); CRIT: PG9.0–19 Beta 3 = 1d (dcs); TINY: PG9.0–19 Beta 3 = 1d (dcs). Advice, pending human review — Editorial inference: Daily rotation matches the weekday filename cycle and creates predictable operational boundaries.

Common pitfalls

  • 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.

logging_collector · log_destination · log_directory · log_filename · log_rotation_size

References