How to configure the log rotation in Confluence 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
As explained in the Configure access logs document, Confluence is able to write access logs by using the Tomcat feature. However, by default, it rotates the files on daily basis using the below access log valve:
1
2
3
4
5
6
7
8
9
10
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
maxDays="30"
pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
prefix="conf_access_log"
fileDateFormat="yyyy-MM-dd"
requestAttributesEnabled="true"
rotatable="true"
suffix=".log"
/>
Environment
Confluence 7.13 or later version.
Solution
To rotate the files more often, the fileDateFormat
should be changed. This will allow Confluence to rotate the files depending on your own preferences.
As an example, the access log valves show the configuration for rotating the logs every hour or every minute:
Rotate the log file every hour
1
2
3
4
5
6
7
8
9
10
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
maxDays="30"
pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
prefix="conf_access_log"
fileDateFormat="yyyy-MM-dd.HH"
requestAttributesEnabled="true"
rotatable="true"
suffix=".log"
/>
Rotate the log file every minute
1
2
3
4
5
6
7
8
9
10
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
maxDays="30"
pattern="%t %{X-AUSERNAME}o %I %h %r %s %Dms %b %{Referer}i %{User-Agent}i"
prefix="conf_access_log"
fileDateFormat="yyyy-MM-dd.HH.mm"
requestAttributesEnabled="true"
rotatable="true"
suffix=".log"
/>
Was this helpful?