DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Reporting and Logging / Where to Log

log_rotation_size

Sets the maximum size a log file can reach before being rotated. 0 disables size-based creation of new log files.

  • Default: 10MB
  • Type: integer (kB)
  • Range: 0 … max (2147483647)
  • Applies: Reload

In plain words

When the current log file grows to this size, the logging collector starts a new one. It keeps single files from becoming too big to open. 0 turns size-based rotation off.

For DBAs and operators

Checked by the logger as it processes incoming output, so a file can end up slightly larger than the limit. Unit is kB without a suffix. Size rotation creates a new name from log_filename; if that name equals the current one (for example with postgresql-%a.log, or the default pattern within the same second), the logger simply keeps appending to the same file, and size rotation achieves nothing.

Size-based rotation never truncates an existing file, even with log_truncate_on_rotation on: truncation is reserved for time-based rotation, to avoid losing a file that was just written.

On busy systems with log_min_duration_statement = 0 or log_statement = all, dozens of GB per day are normal. Decide whether you prefer many 100MB files (rotation by size with a timestamped name) or a bounded ring (time rotation with truncation) and pair it with an external cleanup job either way. Requires logging_collector.

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_rotation_age log_filename log_truncate_on_rotation logging_collector

All Reporting and Logging parameters