Logrotate is very useful command for automatically reduce some disk space, for example noticed that the disk was extremely full by Apache access log, MySQL queries log or NGINX server logs. Once you have configured test your configuration manually can run the logrotate.
# logrotate --force $CONFIG_FILE
--force logrotate to force the rotation,
# logrotate --force /etc/logrotate.d/apache
Simple configurations are,
/var/log/httpd/access_log
{
weekly
missingok
rotate 3
compress
delaycompress
dateext
notifempty
sharedscripts
postrotate
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart > /dev/null
fi
endscript
}
Comments (0)