Jira Log Rotation

How does JIRA log rotation work? I can see our logs in /install directory/jira/logs are beign rolled over once a day but I want to also compress an donly keep so many. There is nothign in /etc/logrotate.d for JIRA logs so I'm not sure where/what is doing it.

Any ideas?

3 answers

1 accepted

1 vote
Accepted answer

I've created a cron to auto delte any logs older then 30 days.

30 2 * * * find /opt/atlassian/jira/logs/*.* -mtime +30 | xargs rm

Hi Brandon,

I've been investigating this same issue as well.

The logs in JIRA's Installation directory are the Tomcat log files, which are not rotated/expired automatically.

The logs in JIRA's Home directory are the Atlassian log files, which are rotated at around 20MB.

My catalina.out log file (in the Installation log directory) at one point was up to 8GB in size. Other log files here weren't as large but dated back years.

Following these links:

I was able to come-up with a log rotation/expiration solution that works:

(Note: The path to your installation directory and log4j.properties may be different than mine)

  1. I edited the <tt>/usr/local/atlassian/jira/atlassian-jira/WEB-INF/classes/log4j.properties</tt> file and removed console logging from the various logging categories:
    sed -i 's/, console,/,/g' log4j.properties
  2. This got rid of the majority of logging from <tt>/usr/local/atlassian/jira/logs/catalina.out</tt>
  3. But there is still some logging when tomcat processes start in catalina.out so I need to rotate/expire this log file. We can use logrotate for this - here is the config I used in /etc/logrotate.d/atlassian:
    /usr/local/atlassian/jira/logs/catalina.out {
    	rotate 6
  4. I'm not sure if you're using Confluence as well. If so, you'll want to set-up log rotation for its catalina.out file as well. I didn't have to modify its log4j.properties file to remove console logging though.
  5. Next you'll want to come up with a scheme for expiring all of the other Tomcat log files. I wrote a script for that runs as a cron job nightly that removes files after they reach an age of my choosing. I'm happy to provide my script to you if you necessary.

Hope this helps get you going in the right direction. Le me know if you have questions.

-- Stephen

Hi Stephen,

I am trying to setup log rotation , request you to share your script which removes file.

2 votes
Pedro Souza Atlassian Team Aug 07, 2014

Hey Brandon.

I don't think it's possible to compress the logs automatically, without using a third-party script or tools.

I would like to send you some pages that may give you a better idea, on how the logging works:





Please, see this another question regarding auto compress the rotated logs:


I hope it helps.


Pedro Souza.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,378 views 15 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you