This module is designed to let AOLserver use multilog from the daemontools package for its access log.
INST should be the location where you installed AOLserver.make INST=/path/to/aolserver install
(Substitute the correct server name in place of "server1".)ns_section ns/server/server1/modules ns_param dqd_log dqd_log.so
You must specify the file descriptor to which the module will send the log, and arrange for that file descriptor to be open. Typically the file descriptor is 3:
To have file descriptor 3 open to a file, you would add a redirection on the AOLserver command line. For example:ns_section ns/server/server1/module/dqd_log ns_param fd 3
/usr/local/aolserver/bin/nsd8x -zft nsd.tcl 2>&1 3>access-log
To use multilog
to manage your access log:
This run script is designed to get multilog running immediately and keep it running even if AOLserver exits.mkdir -p /usr/local/web-access-log/main cd /usr/local/web-access-log mkfifo pipe cat > run <<EOF #!/bin/sh ( echo -n '' > pipe & ) exec /usr/local/bin/multilog t ./main 0<pipe 3>pipe EOF chmod +x run
/service
:
ln -s /usr/local/web-access-log /service
#!/bin/sh exec /usr/local/aolserver/bin/nsd8x -zft /usr/local/web-service/nsd.tcl 2>&1 3>/usr/local/web-access-log/pipe
dqd_log
configuration to your
nsd.tcl
:
ns_section ns/server/server1/modules ns_param dqd_log dqd_log.so ns_section ns/server/server1/module/dqd_log ns_param fd 3
Typically the file descriptor refers to a pipe or FIFO. The program on the other end of the pipe should simply read lines from the pipe and process them according to your wishes. It should close the pipe or exit only if it encounters end-of-file on the pipe. If the module receives an EPIPE (pipe closed) error, it will make AOLserver exit, dropping any pending log entries.
If the module blocks while writing to the file descriptor, AOLserver will block. The module will not drop any log entries in this case.
Each log entry is a Tcl list followed by a newline. The list elements are, in order:
If you run AOLserver behind an HTTP accelerator such as squid, it will only see the IP address where the accelerator is running. It will not see the real client's IP address. However, squid can append the client's IP address to the X-Forwarded-For header. You can have this module log the last word of the X-Forwarded-For headers in place of the peer address. Set the value configuration parameter "AccelAddresses" to the list of IP addresses where squid is running. For example:
The module will only honor the X-Forwarded-For header if the request came from an address listed in AccelAddresses.ns_section ns/server/server1/module/dqd_log # Squid running on localhost and another machine on my private network ns_param AccelAddresses {127.0.0.1 10.0.0.2}
If you wish to log request headers other than Referer and User-Agent, you may specify the "Headers" configuration parameter. It must be a Tcl list off all the request headers you wish to log. If you wish to log the Referer, User-Agent, and Cookie headers, you must list all three, in the order you want them to appear in your log. For example:
By default, dqd_log logs the Referer and User-Agent headers. If you do not wish to log any request headers, specify the empty list:ns_section ns/server/server1/module/dqd_log ns_param Headers {Referer User-Agent Cookie}
ns_section ns/server/server1/module/dqd_log ns_param Headers {}
If you wish to log any reply headers, you may specify the "OutputHeaders" configuration parameter. It must be a Tcl list of all the reply headers you wish to log. For example, if you wish to log the Set-Cookie and Content-Type headers you send in each reply:
By default, dqd_log does not log any reply headers.ns_section ns/server/server1/module/dqd_log ns_param OutputHeaders {Set-Cookie Content-Type}
The request headers are logged in the order listed, followed by the reply headers in the order listed.
$Header: /u/cvsroot/nsd-modules/dqd_log/index.html,v 1.6 2004/10/16 02:43:11 mayoff Exp $