blog.webwesen.com Rotating Header Image

How to rotate catalina.out logs on Linux systems

Tomcat is dumping everything printed out to console to catalina.out by default. And with good uptimes (Tomcat is great :) ) the catalina.out log could get pretty big (in my case it grew to 8Gig).

What is my remedy? Short of messing with catalina’s start.sh – piping the output to some logrotating utility instead of straight to catalina.out – here is what I did:

We’ll leverage logrotate utility, which is most likely already installed if you are on RedHat or CentOS:

add “catalina” file to your /etc/logrotate.d directory


/...path-to-my-catalina.out... {
daily
rotate 7
copytruncate
compress
notifempty
missingok
}

the trick is in using copytrancate parameter as it allows to rotate files in use by other processes – as it is the case with Tomcat’s catalina.out.

No related posts.

One Comment

  1. Anonymous says:

    Thank you very much for the information great post, found it on Yahoo.

Leave a Reply