Sun Java System Web Server 6.1 SP6 NSAPI Programmer's Guide

More on Log Format

The flex-init function recognizes anything contained between percent signs (%) as the name portion of a name-value pair stored in a parameter block in the server. (The one exception to this 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.

(See Chapter 3, Creating Custom SAFs for more information about parameter blocks, and Chapter 7, NSAPI Function Reference.)

Any additional text is treated as literal text, so you can add to the line to make it more readable. Typical components of the formatting parameter are listed in the following table flex-init. Certain components might contain spaces, so they should be bounded by escaped quotes (\").

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%

You can now log cookies by logging the Req-> component.

In the following table, the components that are enclosed in escaped double quotes (\") are the ones that could potentially resolve to values that have white spaces.

Table 2–5 Typical Components of flex-init Formatting

Flex-log Option  


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 variablein Req->vars


Virtual server ID 




Records the time in microseconds the server spent handling the request. Statistics must be enabled for the server instance before %duration% can be used. For information about enabling statistics, see Sun Java System Web Server 6.1 SP6 Administrator’s Guide.