Forum OpenACS Q&A: Writing additional content to access logs

Hi,

I'd like to add some extra content to the AOLserver access logs (not
the server logs) -- a particular log analyzer (Nettracker --
www.sane.com) tracks clickthroughs by having a CGI script add a line
to the access log.

Is there a way in AOLserver to write a line of text to the access log?
Would opening the access log file for append, adding a line and
closing cause a problems?  Probably...

I remember an ns_accesslog command, but it's no longer documented in
3.0+, and it also doesn't have a syntax for log writes.

Any ideas?  Hints?

Paul.

Collapse
Posted by Vadim Nasardinov on

Not sure if this is what you are asking about: https://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0001P9.

This isn't exactly what you need but...

I added host and cookie information to the log using the extendedheaders parameter.

ns_section "ns/server/${server}/module/nslog" 
        ns_param   File            $logdir(${server})/${server}.log
...
        ns_param   extendedheaders HOST,COOKIE   ;# show host information

Collapse
Posted by Andrew Piskorski on
Vadim's solution works very nicely, btw.  I also wanted to log the
user_id to the error (server) log as part of any error message from a
page, but I never did come up with a good way to do that server-wide.
In practice, in the rare ;) cases where a user sees an error on
Production, it's usually possible to manually correlate the error and
access logs to figure out who the user was, if you wish.  Having the
user_id in the error message itself (or e.g. in a Notice immediately
after) would be nifty, though.