Entry
Is there an Apache module that can include a configured cookie in the log file?
Aug 1st, 2004 09:19
Cinley Rodick, unknown unknown, http://www.generalforums.com . http://www.generalforums.com/yellow/
Problem:
The cookie module that comes with Apache only seems to log the cookie it
generates itself.
I would like to be able to log a particular named cookie created by
other software (Java servlet engine) so I can correlate between the
httpd logs and other data.
Solution:
If you look at the mod_log_config page at
http://www.apache.org/docs/mod/mod_log_config.html you'll find that you
can include headers in the form %{HEADERNAME}i in the logs. Just log
the Cookie header from the request. This would then log ALL cookies,
not just your Java module.
Technically, it recognizes the cookie name whether it generated it on
this request or any earlier request, and makes a "note" which is then
logged: %{NOTENAME}n.
If you want to log only your cookie, you could do something like that.
Copy the code from mod_usertrack and look for your cookie only. If you
find it, set a note in the current request, and then configure your log
string to log that note.