6.17.2 Customizing the access log of the in-process HTTP server
The in-process HTTP server outputs the access log, performance analysis trace, thread trace, and communication trace for supporting application development, for performance analysis during operations, and for troubleshooting during failure. You can change the number and size of these files. You can also customize the log output format in the access log.
This section describes the customization of the access log output format in the in-process HTTP server. For details on changing the number and size of the access log and trace files in the in-process HTTP server, see 16.2 Settings for acquiring the in-process HTTP server log.
- Organization of this subsection
(1) Customization procedure
To customize the access log output format:
-
Define the format name of the access log.
To create a new format, add the new format name in the webserver.logger.access_log.format_list parameter in the <configuration> tag of the logical J2EE server (j2ee-server) in the Easy Setup definition file.
- Example settings
... <param> <param-name>webserver.logger.access_log.format_list</param-name> <param-value>formatA</param-value> </param> ...
For creating a new format, reference the access log format provided by default. For details on the format, see (2) Access log format.
-
Define the output format for the access log.
Define the access log output format in the format specified in format-name with the webserver.logger.access_log.format-name parameter within the <configuration> tag of the logical J2EE server (j2ee-server) in the Easy Setup definition file. Specify the argument for the access log format in the output format definition.
- Example settings
... <param> <param-name>webserver.logger.access_log.formatA</param-name> <param-value>%h %u %t "%r" %>s HostHeader="%{host}i"</param-value> </param> ...
For details on the specifiable format arguments, see (3) Arguments of the access log format.
-
Specify the format that will be used to output the access log.
Specify the format name that will be used to output the access log with the webserver.logger.access_log.inprocess_http.usage_format parameter within the <configuration> tag of the logical J2EE server (j2ee-server) in the Easy Setup definition file. An access log is output in the format specified here:
- Example settings
... <param> <param-name>webserver.logger.access_log.inprocess_http.usage_format</param-name> <param-value>formatA</param-value> </param> ...
(2) Access log format
Application Server provides two types of formats namely common (default format) and combined (extended format) as the access log formats of the in-process HTTP server. When creating a new format, reference these formats.
(a) Output format
The output format of access log is described below. Note that Δ indicates one-byte space. Also, for the convenience of expression, the log is output across multiple lines, but the log is actually output in one line.
The output format of a default format is as follows:
Host-name-or-IP-address-of-Web-clientΔRemote-log-nameΔAuthentication-user-name ΔStart-time-of-Web-client-request-processingΔRequest-line ΔFinal-status-codeΔNumber-of-bytes-sent-excluding-the-HTTP-header
The output format of an extended format is described below:
Host-name-or-IP-address-of-Web-clientΔRemote-log-nameΔAuthentication-user-name ΔStart-time-of-Web-client-request-processingΔRequest-line ΔFinal-status-codeΔNumber-of-bytes-sent-excluding-the-HTTP-header Δ"Referer-header-contents"Δ"User-Agent-header-contents"
The underlined part is the difference between the default format and extended format. In the extended format, Referer header contents and User-Agent header contents is output in addition to the output contents of the default format.
(b) Example of output
An example of access log output in the default format is as follows:
10.20.30.40 - user [20/Dec/2004:15:45:01 +0900] "GET /index.html HTTP/1.1" 200 8358 10.20.30.40 - user [20/Dec/2004:15:45:01 +0900] "GET /left.html HTTP/1.1" 200 2358 10.20.30.40 - user [20/Dec/2004:15:45:01 +0900] "GET /right.html HTTP/1.1" 200 4358
An example of access log output in the extended format is as follows:
10.20.30.40 - - [18/Jan/2005:13:06:10 +0900] "GET / HTTP/1.0" 200 38 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" 10.20.30.40 - - [18/Jan/2005:13:06:25 +0900] "GET /demo/ HTTP/1.0" 500 684 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
(3) Arguments of the access log format
The following table lists the arguments of the access log format that are specified when you define the output format of the format:
|
Format arguments |
Output contents |
Example of output |
|---|---|---|
|
%% |
% Sign |
% |
|
%a |
IP address of the Web client |
10.20.30.40 |
|
%A |
IP address of the J2EE server |
10.20.30.100 |
|
%b |
Number of bytes sent excluding the HTTP header ('-' in the case of 0 bytes) |
2048 |
|
%B |
Number of bytes sent excluding the HTTP header ('0' in the case of 0 bytes) |
1024 |
|
%h |
Host name or IP address of the Web client (IP address when the host name cannot be acquired) |
10.20.30.40 |
|
%H |
Request protocol |
HTTP/1.1 |
|
%l |
Remote log name#1 (Always '-') |
- |
|
%m |
Request method |
GET |
|
%p |
Port number that receives the request from the Web client |
80 |
|
%q |
Query string (Begins with '?'. If the query string does not exist, null character) |
?id=100&page=15 |
|
%r |
Request line |
GET /index.html HTTP/1.1 |
|
%>s |
Final status code (Internally redirected value is not output) |
200 |
|
%S#2 |
User's session ID ('-' if the session ID does not exist) |
00455AFE4DA4E7B7789F247B8FE5D605 |
|
%t |
Start time of the Web client request processing (Unit: seconds, output format: dd/MMM/YYYY:HH:mm:ss Z) |
[18/Jan/2005:13:06:10 +0900] |
|
%T |
Time required for processing the Web client request (Unit: seconds) |
2 |
|
%d |
Start time of the Web client request processing (Unit: milliseconds, output format: dd/MMM/YYYY:HH:mm:ss.nnn Z (nnn indicates milliseconds)) |
[18/Jan/2005:13:06:10.152 +0900] |
|
%D |
Time required for processing the Web client request (Unit: milliseconds) |
2000 |
|
%u |
Basic authentication user name, Form authentication user name ('-' when the authentication user name does not exist) |
user |
|
%U |
Request file path |
/index.html |
|
%v |
Local host name of the J2EE server |
server |
|
%{foo}I#3 |
Contents of request header foo ('-' when foo header does not exist) |
In the case of %{Host}i, www.example.com:8888 |
|
%{foo}c |
Of the Cookie information sent by the Web client, contents of Cookie name foo ('-' when the Cookie name does not include foo) |
In the case of %{JSESSIONID}c, 00455AFE4DA4E7B7789F247B8FE5D605 |
|
%{foo}o#3 |
Contents of response header foo ('-' when the foo header does not exist) |
In the case of %{Server}o, CosminexusComponentContainer |
- #1
-
The remote log name is the user name in the Web client that can be acquired with the Identification protocol defined in RFC 1413.
- #2
-
The session ID displayed in %S is the value of the Cookie name 'JSESSIONID'.
- #3
-
The same header name might be sent multiple times in one HTTP request or HTTP response. In this case, the contents of the header read first will be output.
- Important note
-
If there is an error in the specification of the format argument, the default format is used. The example of the use of the default format is as follows:
-
When strings not existing in the list of format arguments (example: %G) is specified
-
When 0 characters (such as %{}i) are specified in the request header contents, response header contents, and Cookie name.
-
- Reference note
-
If the default format and extended format are coded in the format arguments, the format is as follows:
-
Default format
%h %l %u %t "%r" %>s %b
-
Extended format
%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"
-