You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Erik Meyer <er...@rd.bbc.co.uk> on 2000/08/03 13:28:54 UTC
[PATCH] added %{foobar}c to mod_log_config format for selectively logging cookies
I added the format %{foobar}c to mod_log_config.c,
foobar: name of the cookie to be logged.
Very straightforward change, nicked some code from spot_cookie
function out of mod_usertrack and moved it into new log_cookie
function in mod_log_config.c .
Think might be worthwhile addition, as there is no way to
selectively log cookies. The only way I found so far is logging
all cookies with the format string "%{HTTP_COOKIE}e" .
START>>>>>>>>>>>>>>>>>>>
diff -u apache_1.3.12-cooklog/src/modules/standard/mod_log_config.c apache_1.3.12/src/modules/standard/mod_log_config.c
--- apache_1.3.12-cooklog/src/modules/standard/mod_log_config.c Thu Aug 3 11:54:13 2000
+++ apache_1.3.12/src/modules/standard/mod_log_config.c Thu Aug 3 11:58:25 2000
@@ -130,7 +130,6 @@
* %...l: remote logname (from identd, if supplied)
* %...{Foobar}n: The contents of note "Foobar" from another module.
* %...{Foobar}o: The contents of Foobar: header line(s) in the reply.
- * %...{Foobar}c: The cookie with the name Foobar.
* %...p: the port the request was served to
* %...P: the process ID of the child that serviced the request.
* %...r: first line of request
@@ -409,29 +408,6 @@
return ap_table_get(r->subprocess_env, a);
}
-static const char *log_cookie(request_rec *r, char *a)
-{
- /* a is the cookie name */
-
- const char *cookie;
- char *value;
-
- if ((cookie = ap_table_get(r->headers_in, "Cookie")))
- if ((value = strstr(cookie, a))) {
- char *cookiebuf, *cookieend;
-
- value += strlen(a) + 1; /* Skip over the '=' */
- cookiebuf = ap_pstrdup(r->pool, value);
- cookieend = strchr(cookiebuf, ';');
- if (cookieend)
- *cookieend = '\0'; /* Ignore anything after a ; */
-
- return cookiebuf;
- }
-
- return NULL;
-}
-
static const char *log_request_time(request_rec *r, char *a)
{
int timz;
@@ -551,9 +527,6 @@
},
{
'e', log_env_var, 0
- },
- {
- 'c', log_cookie, 0
},
{
'V', log_server_name, 0
>>>>>>>>>>END
--
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
email: Erik.Meyer@rd.bbc.co.uk
SMS: erik.meyer@sms.genie.co.uk
Tel.: +44 1737 839532