How To Change the Tomcat Log Rotation
Overview
This article describes a method to reduce the limit the number of days that Tomcat logs are held on a Swivel appliance.
System Requirements
- Swivel appliance (Hardware or Virtual)
Edit the logrotate configuration
The Swivel appliance uses logrotate to control various log rotations on the system. The Tomcat log rotations are configured using the following file:
/etc/logrotate.d/tomcat
This can be edited using WinSCP. See WinSCP How To Guide.
By default the /var/log/tomcat/catalina.out log files are rotated every 90 days, whilst the /var/log/tomcat/*.log files are rotated every 120 days. This means that 90 days and 120 days worth of log files will be retained indefinitely, respectively.
To alter these values, locate and edit the /etc/logrotate.d/tomcat file using WinSCP and change the values in the file from:
/var/log/tomcat/catalina.out { daily rotate 90 size=1M notifempty missingok copytruncate compress } /var/log/tomcat/*.log { daily missingok copytruncate rotate 120 missingok compress }
To be for example 7 days:
/var/log/tomcat/catalina.out { daily rotate 7 size=1M notifempty missingok copytruncate compress } /var/log/tomcat/*.log { daily missingok copytruncate rotate 7 missingok compress }
Important Note
These logs are contained within the appliance backup each night at 4am so please do not increase these values beyond the defaults specified. By reducing these values you will decrease backup time and increase the space available on the /backups partition.