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

This widget could not be displayed.

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

This widget could not be displayed.

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 {
    	copytruncate
    	dateext
    	monthly
    	rotate 6
    	compress
    	delaycompress
    	missingok
    }
  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

This widget could not be displayed.
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:

https://confluence.atlassian.com/display/JIRA/Logging+and+Profiling

https://confluence.atlassian.com/display/JIRAKB/How+to+Rotate+Catalina+Log+File

https://jira.atlassian.com/browse/JRA-8841

https://jira.atlassian.com/browse/JRA-28941

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

https://answers.atlassian.com/questions/235136/can-i-configure-jira-confluence-to-compress-their-rotated-logs

I hope it helps.

Cheers,

Pedro Souza.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

286 views 1 4
Join discussion

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