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% %Req->srvhdrs.content-length%"
You can now log cookies by logging the Req->headers.cookie.name 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 |
Component |
---|---|
Client host name (unless iponly is specified in flex-log or DNS name is not available) or IP address |
%Ses->client.ip% |
Client DNS name |
%Ses->client.dns% |
System date |
%SYSDATE% |
Full HTTP request line |
\"%Req->reqpb.clf-request%\" |
Status |
%Req->srvhdrs.clf-status% |
Response content length |
%Req->srvhdrs.content-length% |
Response content type |
%Req->srvhdrs.content-type% |
Referer header |
\"%Req->headers.referer%\" |
User-agent header |
\"%Req->headers.user-agent%\" |
HTTP method |
%Req->reqpb.method% |
HTTP URI |
%Req->reqpb.uri% |
HTTP query string |
%Req->reqpb.query% |
HTTP protocol version |
%Req->reqpb.protocol% |
Accept header |
%Req->headers.accept% |
Date header |
%Req->headers.date% |
If-Modified-Since header |
%Req->headers.if-modified-since% |
Authorization header |
%Req->headers.authorization% |
Any header value |
%Req->headers.headername% |
Name of authorized user |
%Req->vars.auth-user% |
Value of a cookie |
%Req->headers.cookie.name% |
Value of any variablein Req->vars |
%Req->vars.varname% |
Virtual server ID |
%vsid% |
Duration |
%duration% 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 SP10 Administrator’s Guide. |