Catalina Logs are not Rotated or Removed
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
catalina.outis not rotatedold
catalina.*.logfiles are not removed
These log files can grow large in size.
Cause
Confluence uses Tomcat's default logging configuration. This configuration means:
catalina.outgets all output from stdout and stderr via ConsoleHandler, and also logs from bootstrap step when you start or stop Confluencecatalina.outis never rotatedcatalina.YYYY-MM-DD.logcontains the output from stdout and stderr via FileHandler, but not the bootstrap logscatalina.YYYY-MM-DD.logfiles are created on the first log event of that date, or when the Tomcat server starts. This means that if there is no log for that date, and the server was not started on that date, then the file is never created.catalina.YYYY-MM-DD.logandcatalina.outfiles are not removedlocalhost,managerandhost-managerlogs are configured similarly tocatalina.YYYY-MM-DD.logfiles
Resolution
Reduce the amount logged to
catalina.out, by disabling the ConsoleHandler. This is done by modifying the conf/logging.properties file. Find the line that looks like this:conf/logging.properties
.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandlerChange it to look like this:
conf/logging.properties
.handlers = 1catalina.org.apache.juli.AsyncFileHandlerThis will reduce the amount of logging to
catalina.out, and does not lose any logging, since all of this output is already being put into the *.log files.Set up a scheduled job, using cron or some alternative, which removes old log files. For example to remove all the files older than one week, a script like this should do the job:
sample_catalina_log_clean.sh
#!/bin/sh find $CONFLUENCE_INSTALL/logs -name 'catalina.*.log' -mtime +1w -print0 | xargs -0 rm -fRemember to replace $CONFLUENCE_INSTALL with your actual Confluence install path, and to test your script on sample data to make sure you don't accidentally delete any logs that you want to keep.
The script above is just a suggestion. It's possible to use some other removal or archiving method if desired.
Was this helpful?