How to rotate Jira access logs

 

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

Summary

There are two types of access logs that can be recorded for Jira.

  • Tomcat access logs which is recorded at JIRA_INSTALL/logs/access_log.YYYY-MM-DD.
  • Jira HTTP access logs which is recorded at JIRA_HOME/log/atlassian-jira-http-access.log.


How to rotate Tomcat access logs

  • This Tomcat log is recorded at JIRA_INSTALL/logs/access_log.YYYY-MM-DD.
  • This Tomcat log is not recorded by Jira product itself, but by the webserver Tomcat which is bundled with Jira.
  • This Tomcat log cannot be rotated by JIRA applications using log4j.properties file ( Jira 9.4 or earlier ) or log4j2.xml file ( Jira 9.5 or newer ) as outlined in Change the rotation file size for Jira server logs
  • So if you would like to rotate Tomcat's access log files, you can set the properties inside the JIRA_INSTALL/conf/server.xml

Steps to rotate:

  1. Edit the file JIRA_INSTALL/conf/server.xml
  2. Find for the property "className="org.apache.catalina.valves.AccessLogValve".
  3. Inside the <Valve tag, where is this property above, in the end of the line, you can add another property named maxDays="7" so that it maintains only max files for 7 days for example.
  4. A restart is required for the changes to take effect. Example below:

    <Valve className="org.apache.catalina.valves.AccessLogValve" pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%{sanitized.query}r %H" %s %b %D "%{sanitized.referer}r" "%{User-Agent}i" "%{jira.request.assession.id}r"" maxDays="7"/>

How to rotate Jira HTTP access logs

  • This log is recorded at JIRA_HOME/log/atlassian-jira-http-access.log.
  • This is a Secondary HTTP access log, written by Jira as opposed to Tomcat.
  • It's only written if HTTP access log debug is enabled at Administration > System > Logging and Profiling > HTTP Access Logging.
  • You can disable them if you woud like to at Administration > System > Logging and Profiling > HTTP Access Logging > Disable the HTTP access log.

Steps to rotate:

  1. Go to JIRA-INSTALL/atlassian-jira/WEB-INF/classes find for the log4j.properties file ( Jira 9.4 or earlier ) or log4j2.xml file ( Jira 9.5 or newer )
  2. Proceed with the steps outlined at Change the rotation file size for Jira server logs
Last modified on Oct 16, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.