Linux

Where Are Linux Log Rotation Rules Stored?

Logrotate files rotation rules in a main config plus a drop-in directory, governing every log on the system.

Last updated

Every Linux log survives because logrotate prunes on schedule. The main config sets global defaults like weekly rotation and count retention. The drop-in directory holds per service rules that packages install and admins extend.

Rules combine frequency, retention, compression, and post scripts into small declarative files. Failures hide until disks fill because rotation runs quietly from cron or timers. Reading the drop-ins explains any log's lifecycle in seconds.

Where Linux stores this, by platform

Linux
/etc/logrotate.conf

Global defaults live here. Per service rules in logrotate.d override them. Test with debug mode before trusting new rules.

Linux
/etc/logrotate.d/

One file per service with frequency, retention, and compression. Packages install their own; admins add custom ones beside them.

Frequently asked questions

How do I test new rules safely?

Run logrotate in debug mode against the config to simulate without touching files. Syntax slips otherwise surface at 3 AM when real rotation fails. The status file records last runs for forensics.

How do I stop a log from eating the disk?

Size caps plus rotation counts bound growth regardless of log volume. Compress and delaycompress tune the tradeoff. Missingok keeps absent logs from erroring the whole run.

Notice an outdated path? Let us know.