From 012d412ccb40c4545f0c54bdd0bdd2a63aa74bbb Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Tue, 6 Nov 2018 11:48:08 +0100 Subject: [PATCH] Issue #113 - CustomRequestLog javadoc detailing the custom log formats Signed-off-by: Lachlan Roberts --- .../jetty/server/CustomRequestLog.java | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java b/jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java index e0beb211a9d..16f1f2c7fa1 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/CustomRequestLog.java @@ -39,6 +39,237 @@ import static java.lang.invoke.MethodHandles.dropArguments; import static java.lang.invoke.MethodHandles.foldArguments; import static java.lang.invoke.MethodType.methodType; +/** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Format StringDescription
%%The percent sign.
%aClient IP address of the request.
%{c}aUnderlying peer IP address of the connection.
%ALocal IP-address.
%BSize of response in bytes, excluding HTTP headers.
%bSize of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.
%{VARNAME}CThe contents of cookie VARNAME in the request sent to the server. Only version 0 cookies are fully supported.
%DThe time taken to serve the request, in microseconds.
%{VARNAME}eThe contents of the environment variable VARNAME.
%fFilename.
%hRemote hostname. Will log the IP address if HostnameLookups is set to Off, which is the default. If it logs the hostname for only a few hosts, you probably have access control directives mentioning them by name. See the Require host documentation.
%HThe request protocol.
%{VARNAME}iThe contents of VARNAME: header line(s) in the request sent to the server. Changes made by other modules (e.g. mod_headers) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use mod_setenvif to copy the header into an internal environment variable and log that value with the %{VARNAME}e described above.
%kNumber 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).
%lRemote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On.
%LThe request log ID from the error log (or '-' if nothing has been logged to the error log for this request). Look for the matching error log line to see what request caused what error.
%mThe request method.
%{VARNAME}nThe contents of note VARNAME from another module.
%{VARNAME}oThe contents of VARNAME: header line(s) in the reply.
%pThe canonical port of the server serving the request.
%{format}pThe canonical port of the server serving the request, or the server's actual port, or the client's actual port. Valid formats are canonical, local, or remote.
%PThe process ID of the child that serviced the request.
%{format}PThe process ID or thread ID of the child that serviced the request. Valid formats are pid, tid, and hextid. hextid requires APR 1.2.0 or higher.
%qThe query string (prepended with a ? if a query string exists, otherwise an empty string).
%rFirst line of request.
%RThe handler generating the response (if any).
%sStatus. For requests that have been internally redirected, this is the status of the original request. Use %>s for the final status.
%tTime the request was received, in the format [18/Sep/2011:19:18:28 -0400]. The last number indicates the timezone offset from GMT
%{format}t + The time, in the form given by format, which should be in an extended strftime(3) format (potentially localized). If the format starts with begin: (default) the time is taken at the beginning of the request processing. If it starts with end: it is the time when the log entry gets written, close to the end of the request processing. + +

In addition to the formats supported by strftime(3), the following format tokens are supported: + +
+ sec         number of seconds since the Epoch
+ msec        number of milliseconds since the Epoch
+ usec        number of microseconds since the Epoch
+ msec_frac   millisecond fraction
+ usec_frac   microsecond fraction
+ 
+ + These tokens can not be combined with each other or strftime(3) formatting in the same format string. You can use multiple %{format}t tokens instead. +
%TThe time taken to serve the request, in seconds.
%{UNIT}TThe 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. Combining %T with a unit is available in 2.4.13 and later.
%uRemote user if the request was authenticated. May be bogus if return status (%s) is 401 (unauthorized).
%UThe URL path requested, not including any query string.
%vThe canonical ServerName of the server serving the request.
%VThe server name according to the UseCanonicalName setting.
%XConnection 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.
%IBytes received, including request and headers. Cannot be zero. You need to enable mod_logio to use this.
%OBytes sent, including headers. May be zero in rare cases such as when a request is aborted before a response is sent. You need to enable mod_logio to use this.
%SBytes transferred (received and sent), including request and headers, cannot be zero. This is the combination of %I and %O. You need to enable mod_logio to use this.
%{VARNAME}^tiThe contents of VARNAME: trailer line(s) in the request sent to the server.
%{VARNAME}^toThe contents of VARNAME: trailer line(s) in the response sent from the server.
+ */ public class CustomRequestLog extends AbstractLifeCycle implements RequestLog { protected static final Logger LOG = Log.getLogger(CustomRequestLog.class);