Hitachi

Hitachi Application Server V10 Definition Reference Guide (For UNIX® Systems)


2.3.40 CustomLog

CustomLog is specified to output the log to a file in a given format.

Description

CustomLog is specified to output the log to a file in a given format, which is the same format as specified in the LogFormat directive.

If you specify this directive more than once, you cannot specify the same file name more than once.

Syntax

CustomLog {file_name|pipe} {"format"|label_name} [env=[!]environment_variable]

Specifiable values

file_name

Specify the file to which the log is to be output. In file_name, you can specify the absolute path or the relative path from the value specified in the ServerRoot directive.

pipe

Specify the program that is to receive log information from the standard input, using the format "|program_name". The web server delivers log information including line feed codes (CRLF).

format

Specify the log format. The following format names can be specified:

Table 2‒1: List of formats

Format

Meaning

%A#1

IP address of the web server

%a#1

IP address of the client

%B

Number of bytes sent (excluding data added by the HTTP header and the chunked encoding)

%b

Number of bytes sent (excluding data added by the HTTP header and the chunked encoding). If the number is 0, a hyphen (-) is output.

%{cookie_name}C

Value of the Cookie name cookie_name included in the Cookie header value. If multiple cookie_names are found in the Cookie header value, all values are output.

%D

Displays the time taken for processing the request.

%{env_name}e

Displays the value for the environment variable set in env_name.

%f

Directory or file name requested by the client

%H

Request protocol (for example, HTTP/1.0)

%h#2

Host name of the client

%I

Number of all the bytes received, including the request and the header

%{header_name}i

Value of the request header specified in header_name

%l

Client identification information (if the IdentityCheck directive is On and identd is running on the client)

%m

Request method (for example, GET or POST)

%{note_name}n

Value of the note specified in note_name in a module in the web server

  • hws_ap_root: root application information

  • hws_ap_client: client application information

%O

Number of all the bytes sent, including the header

%{header_name}o

Value of the response header specified in header_name

%P

ID of the process that processes the HTTP request

%p

Port number of the server specified in accordance with the specified ServerName or <VirtualHost> directive

%q

Query string

%r

First line of the HTTP request

%s

Status (indicates the original status if an internal redirection occurs)

%T

Time taken for the request processing (in seconds). The time is displayed in milliseconds if the HWSLogTimeVerbose directive is On.

%t

Time when the request processing was started. The time is displayed to the millisecond if the HWSLogTimeVerbose directive is On.

%{format}t

Time when the request processing was started. In format, specify the format defined by strftime().

%U

URL

%u

Client user name (if user authentication was performed)

%V#2

Value specified in the ServerName directive, server name, or IP address in accordance with the specified UseCanonicalName directive

%v

Server name

%X

Status of the connection when the response is finished

  • +: The connection will be maintained after the response is sent.

  • -: The connection will be disconnected after the response is sent.

  • X: The connection will be disconnected before the response is finished.

%>s

Final status

Note:

In the formats, the curly brackets { } do not mean "selection". Italic text indicates a variable name of which logs to be collected, while non-italic text indicates the text to be typed as is.

#1

If %A or %a is specified in the format, IPv6 addresses can also be output.

#2

If %h or %V is specified in the format, IPv6 addresses or host names corresponding to IPv6 addresses can be output.

Table 2‒2: List of SSL-related log formats

Format

Meaning

%{version}c

SSL version

%{cipher}c

Cipher type used for the current communication

%{clientcert}c

Distinguished Name in the subject of the SSL client certificate

In the formats, you can add status codes after the percent sign (%).

Example: This example collects the log of the User-Agent request header value if the error status codes are 400 and 501.
 %400,501{User-Agent}i
Example: This example collects the log of the Referer request header value if the error status code is other than 200, 304, or 302.
%!200,304,302{Referer}i

Use env= if you want to split the log and output the parts to different files according to the settings on the specified environment variables.

Example: This example outputs the access log for gif to gif.log, and the access log for anything other than gif to nongif.log.
SetEnvIf Request-URI \.gif$ gif-image
CustomLog logs/gif.log common env=gif-image
CustomLog logs/nongif.log common env=!gif-image
label_name

Specifies the label name defined in the LogFormat directive

env=environment_variable

Collects the log if the specified environment variable is set

env=!environment_variable

Collects the log if the specified environment variable is not set

Locations where it can be written

httpsd.conf and <VirtualHost>

Example

CustomLog logs/access.log common
CustomLog logs/ssl.log "%t %{version}c %{cipher}c %{clientcert}c"