Sun Java System Web Server 7.0 Update 6 Administrator's Configuration File Reference

Appendix C Using the Custom Log File Format

This chapter contains information about the log format used by Web Server. Use these format options to customize the format of your log files. You can enter them through the Admin Console, or edit the format subelement of the access-log element in server.xml. For more information, see access-log.

You can use variables and expressions in log formats with the syntax $variable and $(expression). For more information, see Variables, and Expressions.

Custom Log File Format

When creating a custom log format, anything contained between percent signs (%) is recognized as the name portion of a name-value pair stored in a parameter block in the server. Any additional text is treated as literal text, so you can add to the line to make it more readable. The one exception to the percent sign rule is the %SYSDATE% component, which delivers the current system date. %SYSDATE% is formatted using the time format %d/%b/%Y:%H:%M:%S plus the offset from GMT.

If no format parameter is specified for a log file, the common log format is used:

"%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%]
\"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status%

Typical components of log file format are listed in the following table. Because certain components could resolve to values that contain spaces, they are enclosed in escaped quotes (\").

Table C–1 Typical Components of Custom Log Formatting



Client host name (unless iponly is specified in flex-log or DNS name is not available) or IP address


Client DNS name 


System date 


Full HTTP request line 




Response content length 


Response content type 


Referer header 


User-Agent header 


HTTP method 




HTTP query string 


HTTP protocol version 


Accept header 


Date header 


If-Modified-Since header 


Authorization header 


Any header value 


Name of authorized user 


Value of a cookie 


Value of any variable in Req->vars


Virtual server ID 




Records the time in microseconds the server spent handling the request. Statistics must be enabled before %duration% can be used.

System time 


System time in seconds since 00:00:00 UTC, January 1, 1970. 

Relative time 


System time in seconds since logging started. 

Method number  


A number representing the HTTP method as used in NSAPI. 

HTTP Protocol Version 


A number representing the HTTP protocol version as used in NSAPI. 

HTTP request line 


The method from the HTTP request line. 



The URI from the HTTP request line. 

URI Path 


The absolute path component of the URI 

URI Query 


The query component of the URI. 



The SSL client certificate authentication for web security. 

HTTP Protocol 


The protocol from the HTTP request line. 

Protocol Name 


The name of the protocol. 

Protocol Version 


The version of the protocol. 

Additional log file parameters that can be configured are listed in the following table.

Table C–2 Additional Components of Custom Log Formatting



Cipher name 


Size in bits of cipher key 


Size in bits of private key 


DN for certificate issuer 


DN for certificate user 


SSL session identifier