During installation, the accesslog file is created for the server. You can customize access logging for any resource by specifying whether or not to log accesses, the format to use for logging, and whether or not the server should spend time looking up the domain names of clients when they access a resource.
Access the Server Manager and choose the Logs tab.
Click the Access Log Preferences link.
Enter a new log file location and filename in the Log File: text box.
Click the Only Log: radio button.
Click the Virtual Server Id check box. Alternately click the Custom Format: radio button and add the string ”%vsid%.
When adding the custom format string ”%vsid%, you must use a new access log file.
When changing the format of an existing log file, you should first delete/rename the existing log file OR use a different file name.
Server access logs can be in Common Logfile Format, flexible log format, or your own customizable format. The Common Logfile Format is a commonly supported format that provides a fixed amount of information about the server. The flexible log format allows you to choose (from Sun Java System Web Server) what to log. A customizable format uses parameter blocks that you specify to control what gets logged. For a list of customizable format parameters, see the Sun Java System Web Server 6.1 SP9 NSAPI Programmer’s Guide.
Once an access log for a resource has been created, you cannot change its format unless you archive it or create a new access log file for the resource.
You can specify logging preferences using the Access Log Preferences page in the Server Manager, or you can manually configure the following directives in the obj.conf file. In the magnus.conf file, the server calls the flex-init function to initialize the flexible logging system and the flex-log function to record request-specific data in a flexible log format. To log requests using the common log file format, the server calls init-clf to initialize the Common Log subsystem which is used in the obj.conf, and the common-log to record request-specific data in the common log format (used by most HTTP servers).
For more information on the NSAPI logging functions, including valid directives and parameters, see the Sun Java System Web Server 6.1 SP9 NSAPI Programmer’s Guide.
The Sun Java System Web Server has an easy way to log a specific cookie using the flexlog facility. Add Req->headers.cookie.cookie_name to the Init fn=flex-init line in the magnus.conf file. This logs the value of the cookie variable cookie_name if the cookie variable is present in the request header, and logs - if it is not present.
Init fn=flex-init format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] \"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->headers.cookie.jsessionid%""
All cookie names and header names must be in lowercase.