Citrix Systems Network Router NETSCALER 9.3 User Manual

Page of 195
w
Solaris: The libnswl.a library located in /usr/local/netscaler/bin.
To create the custom log format by using the NSWL Library
1. Add the following two C functions defined by the system in a C source file:
ns_userDefFieldName() : This function returns the string that must be added as a
custom field name in the log record.
ns_userDefFieldVal() : This function implements the custom field value, then
returns it as a string that must be added at the end of the log record.
2. Compile the file into an object file.
3. Link the object file with the NSWL library (and optionally, with third party
libraries) to form a new NSWL executable.
4. Add a %d string at the end of the logFormat string in the configuration file (log.conf).
Example
##########
# A new file is created every midnight or on 
reaching 20MB file size,
# and the file name is /datadisk5/netscaler/log/
NS<hostname>/Nsmmddyy.log and create digital
#signature field for each record.
BEGIN CACHE_F
    logFormat     custom "%a - "%{user-agent}i" [%d/
%B/%Y %T -%g] "%x" %s %b%{referrer}i "%{user-
agent}i" "%{cookie}i" %d "
    logInterval         Daily
    logFileSizeLimit        20
    logFilenameFormat        /datadisk5/netscaler/
log/%v/NS%{%m%d%y}t.log
END CACHE_F
Creating a Custom Log Format Manually
To customize the format in which log file data should appear, specify a character string
as the argument of the LogFormat log property definition. For more information, see 
 on page 118. The following is an example
where character strings are used to create a log format:
 LogFormat Custom ""%a - "%{user-agent}i" %[%d/%m/%Y]t %U %s %b 
%T"
w
The string can contain the “c” type control characters \n and \t to represent new
lines and tabs.
w
Use the <Esc> key with literal quotes and backslashes.
The characteristics of the request are logged by placing % directives in the format
string, which are replaced in the log file by the values.
Citrix NetScaler Administration Guide
115