Re: access log format

From: Henrik Nordstrom <>
Date: Mon, 14 Sep 1998 03:48:04 +0200

Paul Phillips wrote:

> It's not the same thing, though. One of the keys to an access_log
> is that the request line is logged *exactly* as it came from the client.
> That means I get the protocol version, and any query string args, and
> anything else that a client might come up with for that first line.

Then you need to change the code at more than one location. Squid
currently does not save this information after parsing the line.

If you change client_side.c to use urlCanonical instead of
urlCanonicalClean then you get very close to what you want.

Attached is a preleminary patch that adds the missing HTTP version to
1.2beta24-1, but Squid can only emulate the common log format, it does
not keep the request line after parsing it, and it is therefore hard to
log it exactly as it was received, but as long as the requests are legal
it should be the same except that extra whitespace that is stripped from
the request line and HTTP is normalised to upper case.

Henrik Nordström
Sparetime Squid Hacker

Index: squid/src/access_log.c
diff -u squid/src/access_log.c: squid/src/access_log.c:
--- squid/src/access_log.c: Wed Aug 19 03:20:22 1998
+++ squid/src/access_log.c Mon Sep 14 03:42:02 1998
@@ -191,12 +191,13 @@
         client = fqdncache_gethostbyaddr(al->cache.caddr, 0);
     if (client == NULL)
         client = inet_ntoa(al->cache.caddr);
- memBufPrintf(mb, "%s %s - [%s] \"%s %s\" %d %d %s:%s",
+ memBufPrintf(mb, "%s %s - [%s] \"%s %s HTTP/%.1f\" %d %d %s:%s",
+ al->http.version,
Index: squid/src/client_side.c
diff -u squid/src/client_side.c: squid/src/client_side.c:
--- squid/src/client_side.c: Mon Sep 7 06:59:15 1998
+++ squid/src/client_side.c Mon Sep 14 03:42:03 1998
@@ -597,6 +597,7 @@
             packerToMemInit(&p, &mb);
             httpHeaderPackInto(&request->header, &p);
             http->al.http.method = request->method;
+ http->al.http.version = request->http_ver;
             http->al.headers.request = xstrdup(mb.buf);
             http->al.hier = request->hier;
Index: squid/src/structs.h
diff -u squid/src/structs.h: squid/src/structs.h:
--- squid/src/structs.h: Sat Aug 22 20:47:57 1998
+++ squid/src/structs.h Mon Sep 14 03:42:05 1998
@@ -739,6 +739,7 @@
         method_t method;
         int code;
         const char *content_type;
+ float version;
     } http;
     struct {
         icp_opcode opcode;
Received on Sun Sep 13 1998 - 18:54:15 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:42:01 MST