Skip to content

log_rotation_size

log_rotation_size is the PostgreSQL setting that defines the maximum size a log file can reach before being rotated.
Note

Fact — official short description: “Sets the maximum size a log file can reach before being rotated.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , ValuekB
Raw unit
Range , Value02147483647
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 , Value10240
10 MiB

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 10240 kB 10 MiB

How it works

log_rotation_size sets the maximum size a log file can reach before being rotated. 0 disables size-based creation of new log files. The collector rotates when the current file reaches approximately this size; zero disables the size trigger but not time-based rotation.

log_rotation_size 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 Use a nonzero log_rotation_size when file size itself must be bounded, and coordinate it with a filename that cannot collide during multiple rotations in one time period. If set to zero, verify that time-based rotation and disk alerts provide the bound instead.
OLAP Analytical bursts can cross a size threshold repeatedly; test the resulting filename suffixes, shipping throughput, and maximum single-file size rather than choosing a larger number by habit.
Small nodes A modest size cap limits damage from a logging spike, but too-small files increase metadata and shipping overhead. Zero is acceptable only with a proven time-based cycle and free-space guardrail.

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 0 different '0'
OLAP 0 different '0'
CRIT 0 different '0'
TINY 0 different '0'
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 0 (dcs); OLAP: PG9.0–19 Beta 3 = 0 (dcs); CRIT: PG9.0–19 Beta 3 = 0 (dcs); TINY: PG9.0–19 Beta 3 = 0 (dcs). Advice, pending human review — Editorial inference: Disabling size rotation appears intended to make daily time rotation the single file-cycle authority; disk safeguards still need independent verification.

Common pitfalls

  • Editing log_rotation_size 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.
  • Setting zero without a working time-based or external rotation policy and allowing unbounded growth.

logging_collector · log_destination · log_directory · log_filename · log_rotation_age

References