mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Merge pull request #1130 from pi-hole/new/logrotate
Use logrotate for pihole.log
This commit is contained in:
commit
63d02df0bc
3 changed files with 18 additions and 1 deletions
|
@ -11,5 +11,10 @@
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
echo -n "::: Flushing /var/log/pihole.log ..."
|
echo -n "::: Flushing /var/log/pihole.log ..."
|
||||||
echo " " > /var/log/pihole.log
|
# Test if logrotate is available on this system
|
||||||
|
if command -v /usr/sbin/logrotate &> /dev/null; then
|
||||||
|
/usr/sbin/logrotate --force /etc/.pihole/advanced/logrotate
|
||||||
|
else
|
||||||
|
echo " " > /var/log/pihole.log
|
||||||
|
fi
|
||||||
echo "... done!"
|
echo "... done!"
|
||||||
|
|
9
advanced/logrotate
Normal file
9
advanced/logrotate
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/var/log/pihole.log {
|
||||||
|
daily
|
||||||
|
copytruncate
|
||||||
|
rotate 5
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
notifempty
|
||||||
|
nomail
|
||||||
|
}
|
|
@ -23,4 +23,7 @@
|
||||||
|
|
||||||
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control
|
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control
|
||||||
# Stats will be viewable in the Web interface thanks to the cron job above
|
# Stats will be viewable in the Web interface thanks to the cron job above
|
||||||
|
# The flush script will use logrotate if available
|
||||||
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush
|
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush
|
||||||
|
|
||||||
|
@reboot root /usr/sbin/logrotate /etc/.pihole/advanced/logrotate
|
||||||
|
|
Loading…
Reference in a new issue