How to configure Catalina log rotation
  • Dark

How to configure Catalina log rotation

  • Dark


This page explains how to configure the Catalina log rotation. This practice can prove efficacious in situations such as "disk is full" or when a user has a specific need for custom rotation rules.

Use Information

The current active log, as well as older files, can be found here: /var/log/tomcat.

The Catalina rotation log may already have default settings present.


1. ssh to the Matillion host and become root using the sudo su - command.

2. Create the /etc/logrotate.d/tomcatrotate file with the following contents:

Important Information

Please note that the file to be created in step 2 does not yet exist, and therefore you need to create it yourself as the step suggests.

/var/log/tomcat*/catalina.out {
rotate 52
create 0644 tomcat tomcat

The above configuration maintains the last 52 files. Please note that size takes precedence over time.

3. Manually run the "rotate logs" command:

sudo logrotate -f /etc/logrotate.d/tomcatrotate

To validate that the manual log rotation was successful, run the following command from the SSH session:

sudo ls -trl /var/log/tomcat

In the command line results, you should see an archived catalina.out file with the following name format: catalina.out-YYYYMMDD.gz where YYYYMMDD represents the current date.

You will now see a very small (or possibly even empty) catalina.out file.

Step 3 (above) will rotate the logs. Please note that from that point, rotation will happen automatically.