Skip to content

Instantly share code, notes, and snippets.

@SkaTeMasTer
Created February 13, 2017 08:51
Show Gist options
  • Save SkaTeMasTer/8807de8821edb6c17ba8327e1ba1ebd6 to your computer and use it in GitHub Desktop.
Save SkaTeMasTer/8807de8821edb6c17ba8327e1ba1ebd6 to your computer and use it in GitHub Desktop.
Log rotate is important to keep the SD cards on Raspberry pi from corruption, disable any logging when possible (after debugging)
Logfile RoATING file operations using UNIX logrotate utility.
=============================================
+ Rotate the log file when file size reaches a specific size
+ Continue to write the log information to the newly created file after rotating the old log file
+ Compress the rotated log files
+ Specify compression option for the rotated log files
+ Rotate the old log files with the date in the filename
+ Execute custom shell scripts immediately after log rotation
+ Remove older rotated log files
Logrotate Configuration files
=============================================
Following are the key files that you should be aware of for logrotate to work properly.
+ /usr/sbin/logrotate – The logrotate command itself.
+ /etc/cron.daily/logrotate – This shell script executes the logrotate command everyday.
+ /etc/logrotate.conf – Log rotation configuration for all the log files are specified in this file.
PIHOLE RECOMMENDED
==============================
/var/log/pihole.log {
# su #
daily
copytruncate
rotate 5
compress
delaycompress
notifempty
nomail
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment