Time for action – configuring Logrotate
Logon as root to your Cacti system.
Create a new file in the
/etc/logrotate.d
directory using vi:vi /etc/logrotate.d/cactilog
Insert the following code:
/var/www/html/cacti/log/cacti.log { daily rotate 7 copytruncate compress notifempty missingok }
Save the file and quit.
Check if the configuration file is correct:
logrotate /etc/logrotate.conf –v
You should see text similar to the following somewhere in the output:
What just happened?
You just created a configuration file for logrotate to manage the Cacti
log. The settings you entered will make sure that logrotate will rotate the file on a daily basis, keeping 7 days worth of logs and compressing the old files at the same time. Logrotate will not rotate the file if it is empty and will also not throw an error if the file is missing.