How to configure the log rotation in Confluence access logs
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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:
<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:
<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"
/>
<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"
/>