Add the following highlighted setting inside host name="default-host" under Undertow subsystem in profile you are using.
e.g. It would be in one of the followings depending on the profile you have configured in your application.
Also note that you need to set record-request-start-time attribute to true for the listener(http-listener, ajp-listener and https-listener which you are using) to log response time (%D in milliseconds or %T in seconds) in access logging
This will be logged to the JBoss log directory by default. You may specify a custom directory through the directory parameter. You may also add the relative-to="XXXXX" parameter to make that custom directory relative to another.
Also note that you need to set record-request-start-time attribute to true for the listener(http-listener, ajp-listener and https-listener which you are using) to log response time (%D in milliseconds or %T in seconds) in access logging
This will be logged to the JBoss log directory by default. You may specify a custom directory through the directory parameter. You may also add the relative-to parameter to make that custom directory relative to another.
Find below more details for access log pattern used above;
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
There is also support to write information from the cookie, incoming header, or the session
It is modeled after the apache syntax:
e.g. It would be in one of the followings depending on the profile you have configured in your application.
- standalone-ha.xml: Default profile with clustering capabilities
- standalone-full-ha.xml: Full profile with clustering capabilities
- standalone-full.xml: Support of Java EE Full-Profile and all server capabilities without
clustering
- standalone.xml: Support of Java EE Web-Profile plus some extensions like RESTFul Web
Services and support for EJB3 remote invocations
<subsystem xmlns="urn:jboss:domain:undertow:4.0">
.....
<server name="default-server">
<http-listener name="default" socket-binding="http" record-request-start-time="true" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" record-request-start-time="true" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<access-log pattern="%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}" "%{i,COOKIE}" "%{o,SET-COOKIE}" %S "%I" %T" directory="/accesslog" relative-to="jboss.server.log.dir"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<http-invoker security-realm="ApplicationRealm"/>
</host>
</server>
.....
</subsystem>
Also note that you need to set record-request-start-time attribute to true for the listener(http-listener, ajp-listener and https-listener which you are using) to log response time (%D in milliseconds or %T in seconds) in access logging
This will be logged to the JBoss log directory by default. You may specify a custom directory through the directory parameter. You may also add the relative-to="XXXXX" parameter to make that custom directory relative to another.
Also note that you need to set record-request-start-time attribute to true for the listener(http-listener, ajp-listener and https-listener which you are using) to log response time (%D in milliseconds or %T in seconds) in access logging
This will be logged to the JBoss log directory by default. You may specify a custom directory through the directory parameter. You may also add the relative-to parameter to make that custom directory relative to another.
Find below more details for access log pattern used above;
- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name
- %H - Request protocol
- %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %p - Local port
- %q - Query string (excluding the '?' character)
- %r - First line of the request
- %s - HTTP status code of the response
- %t - Date and time, in Common Log Format format
- %u - Remote user that was authenticated
- %U - Requested URL path
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
- %I - current Request thread name (can compare later with stacktraces)
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
- common - %h %l %u %t "%r" %s %b
- combined - %h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
There is also support to write information from the cookie, incoming header, or the session
It is modeled after the apache syntax:
- %{i,xxx} for incoming headers
- %{o,xxx} for outgoing response headers
- %{c,xxx} for a specific cookie
- %{r,xxx} xxx is an attribute in the ServletRequest
- %{s,xxx} xxx is an attribute in the HttpSession