logrotate is package (similar software in Windows OS) in Linux.
Log files generated by the system and running applications continue to grow over time.
logrotate prevents this issue by periodically renames existing active log files, automatically compresses rotated historical log files etc.
systemd executes the logrotate command.
The logrotate.timer triggers logrotate.service once per day to clean up and rotates the logs.
Tutorial
Lists all currently active timers
systemctl list-units -t timer
Checks logrotate units files
systemctl list-unit-files logrotate*
Displays the status of the logrotate.service
systemctl status logrotate.service
Check the configuration of the logrotate.service
systemctl cat logrotate.service
Displays the status of the logrotate.timer
systemctl status logrotate.timer
Check the configuration of the logrotate.timer
systemctl cat logrotate.timer
Result
student@localhost:~$ systemctl list-units -t timer
UNIT LOAD ACTIVE SUB DESCRIPTION
dnf-makecache.timer loaded active waiting dnf makecache --timer
fstrim.timer loaded active waiting Discard unused filesystem blocks once a week
fwupd-refresh.timer loaded active waiting Refresh fwupd metadata regularly
logrotate.timer loaded active waiting Daily rotation of log files
plocate-updatedb.timer loaded active waiting Update the plocate database daily
raid-check.timer loaded active waiting Weekly RAID setup health check
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
Legend: LOAD → Reflects whether the unit definition was properly loaded.
ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
SUB → The low-level unit activation state, values depend on unit type.
7 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
student@localhost:~$ systemctl list-unit-files logrotate*
UNIT FILE STATE PRESET
logrotate.service static -
logrotate.timer enabled enabled
2 unit files listed.
student@localhost:~$ systemctl status logrotate.service
○ logrotate.service - Rotate log files
Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static)
Active: inactive (dead) since Tue 2026-09-01 15:32:50 +08; 1h 1min ago
Invocation: 174a1206e34549ecb0ee697b5541e2e4
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
man:logrotate.conf(5)
Process: 2784 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
Main PID: 2784 (code=exited, status=0/SUCCESS)
Mem peak: 3.6M
CPU: 174ms
Sep 01 15:32:50 localhost.localdomain systemd[1]: Starting logrotate.service - Rotate log files...
Sep 01 15:32:50 localhost.localdomain systemd[1]: logrotate.service: Deactivated successfully.
Sep 01 15:32:50 localhost.localdomain systemd[1]: Finished logrotate.service - Rotate log files.
student@localhost:~$ systemctl cat logrotate.service
# /usr/lib/systemd/system/logrotate.service
[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
RequiresMountsFor=/var/log
ConditionACPower=true
[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf
# performance options
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7
# hardening options
# details: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
# no ProtectHome for userdir logs
# no PrivateNetwork for mail deliviery
# no NoNewPrivileges for third party rotate scripts
# no RestrictSUIDSGID for creating setgid directories
LockPersonality=true
MemoryDenyWriteExecute=true
PrivateDevices=true
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=full
RestrictNamespaces=true
RestrictRealtime=true
student@localhost:~$ systemctl status logrotate.timer
● logrotate.timer - Daily rotation of log files
Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; enabled; preset: enabled)
Active: active (waiting) since Tue 2026-09-01 15:30:19 +08; 1h 6min ago
Invocation: 62fdee7e98614248a7442d010b56f283
Trigger: Wed 2026-09-02 00:24:25 +08; 7h left
Triggers: ● logrotate.service
Docs: man:logrotate(8)
man:logrotate.conf(5)
Sep 01 15:30:19 localhost.localdomain systemd[1]: Started logrotate.timer - Daily rotation of log files.
student@localhost:~$ systemctl cat logrotate.timer
# /usr/lib/systemd/system/logrotate.timer
[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target
student@localhost:~$