Using logrotate to manage Apache Tomcat's catalina.out log file

Apache Tomcat does not roll its catalina.out log each day (or after a given size). It is a small annoyance but nevertheless it is an annoyance. The solution is to have logrotate do for you. Add the following to the crontab

0 0 * * * /usr/sbin/logrotate -v --state $HOME/var/logrotate.status $HOME/etc/logrotate.conf

Set the logrotate.conf to

$HOME/lib/apache-tomcat-5.5.28/logs/catalina.out {
  daily
  rotate 10
  copytruncate
  compress
  missingok
}
# END


Notes: I run Tomcat from within its own user directory and so all paths are relative to $HOME. Logroate does not perform environment variable substitution on the configuration and so replace $HOME in logrotate.conf with the actual path.