Tomcat Valve Component Audit log date format customisation

Still need help?

The Atlassian Community is here for you.

Ask the community


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

When enabling the access log via Tomcat's Valve Component, the default log date format is dd/M/yyyy:hh:mm:ss:

[29/Sep/2020:15:17:19 +1000] Apache-HttpClient/4.5.6 (Java/1.8.0_151) 127.0.0.1 GET GET /c740/rest/gadgets/1.0/g/messagebundle/und/gadget.common%2Cgadget.activity.stream HTTP/1.1 3910 200 1652 http-nio-6740-exec-1

This can be customised to a different format such as yyyy-MM-dd hh:mm:ss

Environment

Tomcat

Solution

Below is an example of how to do this in server.xml file:

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" requestAttributesEnabled="true" prefix="confluence_access_log" suffix=".log" pattern="%{yyyy-MM-dd HH:mm:ss.SSSZ}t %{X-AUSERNAME}o %{User-Agent}i %h %m %r %b %s %D %I" />

Output:

2020-09-29 15:26:38.384+1000 - Apache-HttpClient/4.5.6 (Java/1.8.0_151) 127.0.0.1 GET GET /c740/rest/gadgets/1.0/g/messagebundle/und/gadget.common%2Cgadget.activity.stream HTTP/1.1 3910 200 1652 http-nio-6740-exec-10



Last modified on Oct 14, 2020

Was this helpful?

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