1

What is the access log pattern for logging the total response time to the request on undertow subsystem ?

<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                <access-log  prefix="access" pattern="%h %t %U%q %m %s %b %T"/>   <!-- use-server-log="true" -->
                    <location name="/" handler="welcome-content"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
        </subsystem>

The %T is recording just a '-' in the logs. Please help.

Saurabh Kedia
  • 11
  • 1
  • 3

2 Answers2

3

Here i found the following hint:

Time taken to process the request, in seconds. It won't work unless record-request-start-time is set to true, see %D above.

There is also a link how you can configure it. record-request-start-time

wirnse
  • 1,026
  • 8
  • 7
  • thanks a lot. seems to work. What is the unit of time ? Can that be configured to millisecond? – Saurabh Kedia Nov 01 '18 at 23:37
  • Use %D instead of %T – wirnse Nov 02 '18 at 06:58
  • thanks a lot. however is there a way to also log the actual remote IP of the requestor? who could be behind a proxy ? – Saurabh Kedia Nov 09 '18 at 10:24
  • well... try to read the whole [page](https://kb.novaordis.com/index.php/Undertow_WildFly_Subsystem_Configuration_-_access-log#Pattern_Elements) or at least use the search. I did not test it but i believe it is `%a`. About the Proxy i dont know. maybe you can create a new question – wirnse Nov 09 '18 at 11:13
  • I am looking to have %v - local server name , but without port number printed in it, any way we can achieve this ? Using undertow log pattern? – rinilnath Dec 31 '21 at 06:43
0

If you start undertow with Spring Boot, the properties are

server.undertow.options.server.record-request-start-time=true
server.undertow.accesslog.pattern=[...] %T
derdualist
  • 81
  • 3