Logrotate is a great utility to manage and adminster log files in a system. It provides you with a lot of options, namely, automatic rotation, compression and mailing of log files. Each log file can be rotated hourly, daily, weekly or monthly. In this article, I will show you how to manage your log files using logrotate.
You can add your own configuration file like /etc/logrotate.d/LPapache which defines which files should be rotated.
Example of configuration file:
/etc/logrotate.d/LPapache
/liveperson/data/server_tomcat/logs/*txt /liveperson/data/server_tomcat/logs/*log /liveperson/data/server_tomcat/logs/catalina.out {
copytruncate
daily
rotate 365
missingok
dateext
sharedscripts
compress
}
Another example /etc/logrotate.d/LPapache:
/liveperson/data/server_apache/logs/*log {
rotate 365
missingok
size 500M
dateext
sharedscripts
compress
postrotate
/sbin/service LPapache reload > /dev/null 2>/dev/null || true
endscript
}
More info here
http://linuxers.org/howto/howto-use-logrotate-manage-log-files
No comments:
Post a Comment