Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
on 07-26-2024 01:40 PM
This article covers the steps to enable access/request log in a custom format for a Jetty-based controller, specifically for controllers with a version greater than or equal to v23.11.
To begin, please follow these steps:
--module=customrequestlog
jetty.customrequestlog.formatString=%{client}a - %u %{dd/MMM/yyyy:HH:mm:ss ZZZ|GMT}t "%r" %s %O "%{Referer}i" "%{User-Agent}i"
jetty.customrequestlog.formatString can be modified according to your specific requirements.
Here's the format codes to configure access log format
Format String | Description |
%% | The percent sign. |
%{format}a | Address or Hostname. Valid formats are {server, client, local, remote} Optional format parameter which will be server by default. Where server and client are the logical addresses which can be modified in the request headers, while local and remote are the physical addresses so may be a proxy between the end-user and the server. |
%{format}p | Port. Valid formats are {server, client, local, remote} Optional format parameter which will be server by default. Where server and client are the logical ports which can be modified in the request headers, while local and remote are the physical ports so may be to a proxy between the end-user and the server. |
%{CLF}I | Size of request in bytes, excluding HTTP headers. Optional parameter with value of "CLF" to use CLF format, i.e. a '-' rather than a 0 when no bytes are sent. |
%{CLF}O | Size of response in bytes, excluding HTTP headers. Optional parameter with value of "CLF" to use CLF format, i.e. a '-' rather than a 0 when no bytes are sent. |
%{CLF}S | Bytes transferred (received and sent). This is the combination of %I and %O. Optional parameter with value of "CLF" to use CLF format, i.e. a '-' rather than a 0 when no bytes are sent. |
%{VARNAME}C | The contents of cookie VARNAME in the request sent to the server. Only version 0 cookies are fully supported. Optional VARNAME parameter, without this parameter %C will log all cookies from the request. |
%D | The time taken to serve the request, in microseconds. |
%{VARNAME}e | The contents of the environment variable VARNAME. |
%f | Filename. |
%H | The name and version of the request protocol, such as "HTTP/1.1". |
%{VARNAME}i | The contents of VARNAME: header line(s) in the request sent to the server. |
%k | Number of keepalive requests handled on this connection. Interesting if KeepAlive is being used, so that, for example, a '1' means the first keepalive request after the initial one, '2' the second, etc...; otherwise this is always 0 (indicating the initial request). |
%m | The request method. |
%{VARNAME}o | The contents of VARNAME: header line(s) in the response. |
%q | The query string (prepended with a ? if a query string exists, otherwise an empty string). |
%r | First line of request. |
%R | The handler generating the response (if any). |
%s | Response status. |
%{format|timeZone|locale}t | The time that the request was received. Optional parameter in one of the following formats {format}, {format|timeZone} or {format|timeZone|locale}. Format Parameter: (default format [18/Sep/2011:19:18:28 -0400] where the last number indicates the timezone offset from GMT.) Must be in a format supported by DateCache TimeZone Parameter: Default timeZone GMT Must be in a format supported by TimeZone.getTimeZone(String) Locale Parameter: Default locale Locale.getDefault() Must be in a format supported by Locale.forLanguageTag(String) |
%T | The time taken to serve the request, in seconds. |
%{UNIT}T | The time taken to serve the request, in a time unit given by UNIT. Valid units are ms for milliseconds, us for microseconds, and s for seconds. Using s gives the same result as %T without any format; using us gives the same result as %D. |
%{d}u | Remote user if the request was authenticated with servlet authentication. May be bogus if return status (%s) is 401 (unauthorized). Optional parameter d, with this parameter deferred authentication will also be checked, this is equivalent to HttpServletRequest.getRemoteUser(). |
%U | The URL path requested, not including any query string. |
%X | Connection status when response is completed: X = Connection aborted before the response completed. + = Connection may be kept alive after the response is sent. - = Connection will be closed after the response is sent. |
%{VARNAME}^ti | The contents of VARNAME: trailer line(s) in the request sent to the server. |
%{VARNAME}^to | The contents of VARNAME: trailer line(s) in the response sent from the server. |
Click Save
The access/request log will be created under <controller-home>/appserver/jetty/logs/
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form