Cleaning up logs in Jira and Confluence

Daniel Smith April 12, 2017

I would like to cleanup the log files in /opt/atlassian/(jira|confluence)/logs/. I have enabled logrotate, but tomcat is creating dated log files, ie catalina.2017-03-27.log, which defeats logrotate. I have foud where to disabled rotation for the access log in the server.xml file, but I can't find where to do this for catalina.out.

I would like to either disable the tomcat rotation so that logrotate can manage the logs or if it makes more sense, set a limit to how many logs tomcat keeps. Can someone please point me to where this is configured and what options there are specific to rotation or a link to where this is documented? The Configuring Logging section only includes info on enabling/disabling and levels from what I can see. I did not see anything for rotation.

2 answers

2 votes
Daniel Smith April 17, 2017

So I ended up doing as errno suggested since even Jira support seems to be unaware of this behavior and just keeps referencing back to their broken documentation. I wrote a script that deletes access.log.* and *.log files with a modified date of more than 30 days. I'll just check after an upgrade to make sure this behavior hasn't changed again. 

If it helps anyone, the command that is run is:

find /opt/atlassian/jira/logs/ -maxdepth 1 -name "*.log" -mtime +30 -exec rm {} \;

0 votes
Andrei [errno]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2017

we just added a cron.weekly entry to clean-up the directory (a simple shell script). works well and has a benefit of being pushed into our code repo...

Daniel Smith April 14, 2017

I would like to avoid writing another script to clean up when there are already tools to do this, but thank you for the suggestion.

Suggest an answer

Log in or Sign up to answer