pi-hole/advanced/Templates/logrotate
Adam Warner cacc934300
Force nodateext so rotated log names don't depend on invocation path
If the system's /etc/logrotate.conf has dateext enabled (the upstream
default, carried by most distros), our stanzas would inherit it when
the system's scheduled logrotate reads them via that file - but our
own forced runs invoke /etc/logrotate.d/pihole directly, bypassing
logrotate.conf entirely, so they'd still use numeric suffixes. Same
config, two different rotated filenames depending on who rotated it
first.

Set nodateext explicitly in each of our stanzas (scoped to just our
own blocks, so it can't leak into other packages' logrotate.d entries)
to keep this deterministic. Numeric suffixes also match what
piholeLogFlush.sh's manual flush path already assumes (it looks for
logfile.1 specifically).

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2026-07-07 14:34:01 +01:00

39 lines
705 B
Text

/var/log/pihole/pihole.log {
# su #
daily
create 640 pihole pihole
rotate 5
compress
delaycompress
notifempty
nomail
nodateext
postrotate
kill -USR2 $(cat /run/pihole-FTL.pid 2>/dev/null) 2>/dev/null || true
endscript
}
# FTL.log and webserver.log are opened and closed for each line, therefore no postrotate is needed
/var/log/pihole/FTL.log {
# su #
weekly
create 640 pihole pihole
rotate 3
compress
delaycompress
notifempty
nomail
nodateext
}
/var/log/pihole/webserver.log {
# su #
weekly
create 640 pihole pihole
rotate 3
compress
delaycompress
notifempty
nomail
nodateext
}