Catalina Logs are not Rotated or Removed
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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.out
is not rotated- old
catalina.*.log
files are not removed
These log files can grow large in size.
Cause
Confluence uses Tomcat's default logging configuration. This configuration means:
catalina.out
gets all output from stdout and stderr via ConsoleHandler, and also logs from bootstrap step when you start or stop Confluencecatalina.out
is never rotatedcatalina.YYYY-MM-DD.log
contains the output from stdout and stderr via FileHandler, but not the bootstrap logscatalina.YYYY-MM-DD.log
files 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.log
andcatalina.out
files are not removedlocalhost
,manager
andhost-manager
logs are configured similarly tocatalina.YYYY-MM-DD.log
files
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.ConsoleHandler
Change it to look like this:
conf/logging.properties.handlers = 1catalina.org.apache.juli.AsyncFileHandler
This 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 -f
Remember 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.