How to rotate Jira access logs
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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 twotypes 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.
Solution
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.4orearlier ) or log4j2.xml file ( Jira9.5 or newer ) as outlined in Change the rotation file size for Jira server logs
So if you would like to rotateTomcat'saccess log files, you can set the properties inside the JIRA_INSTALL/conf/server.xml
Steps to rotate:
Edit the file JIRA_INSTALL/conf/server.xml
Find for the property "className="org.apache.catalina.valves.AccessLogValve".
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.
A restart is required for the changes to take effect. Example below:
1
<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:
Go to JIRA-INSTALL/atlassian-jira/WEB-INF/classes find for the log4j.properties file ( Jira 9.4orearlier ) or log4j2.xml file ( Jira9.5 or newer )
Proceed with the steps outlined at Change the rotation file size for Jira server logs
Was this helpful?