diff -r -c ../squid-2.2.STABLE4/src/access_log.c ./src/access_log.c *** ../squid-2.2.STABLE4/src/access_log.c Sun Apr 18 20:21:20 1999 --- ./src/access_log.c Thu Aug 19 13:47:22 1999 *************** *** 41,46 **** --- 41,47 ---- static char *log_quote(const char *header); static void accessLogSquid(AccessLogEntry * al, MemBuf * mb); static void accessLogCommon(AccessLogEntry * al, MemBuf * mb); + static void accessLogExtended(AccessLogEntry * al, MemBuf * mb); #if MULTICAST_MISS_STREAM static int mcast_miss_fd = -1; *************** *** 212,217 **** --- 213,245 ---- } static void + accessLogExtended(AccessLogEntry * al, MemBuf * mb) + { + const char *client = NULL; + const char *referer = NULL; + const char *useragent = NULL; + if (Config.onoff.log_fqdn) + client = fqdncache_gethostbyaddr(al->cache.caddr, 0); + if (client == NULL) + client = inet_ntoa(al->cache.caddr); + useragent = httpHeaderGetStr(al->headers.request_hdr, HDR_USER_AGENT); + referer = httpHeaderGetStr(al->headers.request_hdr, HDR_REFERER); + memBufPrintf(mb, "%s %s - [%s] \"%s %s HTTP/%.1f\" %d %d \"%s\" \"%s\" %s:%s", + client, + al->cache.ident, + mkhttpdlogtime(&squid_curtime), + al->private.method_str, + al->url, + al->http.version, + al->http.code, + al->cache.size, + referer ? referer : "-", + useragent ? useragent : "-", + log_tags[al->cache.code], + hier_strings[al->hier.code]); + } + + static void accessLogOpen(const char *fname) { assert(fname); *************** *** 254,259 **** --- 282,289 ---- if (Config.onoff.common_log) accessLogCommon(al, &mb); + else if (Config.onoff.extended_log) + accessLogExtended(al, &mb); else accessLogSquid(al, &mb); if (Config.onoff.log_mime_hdrs) { diff -r -c ../squid-2.2.STABLE4/src/cf.data.pre ./src/cf.data.pre *** ../squid-2.2.STABLE4/src/cf.data.pre Fri May 7 16:44:11 1999 --- ./src/cf.data.pre Thu Aug 19 13:51:35 1999 *************** *** 673,678 **** --- 673,695 ---- DOC_END + NAME: emulate_extended_httpd_log + COMMENT: on|off + TYPE: onoff + DEFAULT: off + LOC: Config.onoff.extended_log + DOC_START + The Cache can emulate the log file format which many 'httpd' + programs use. To disable/enable this emulation, set + emulate_extended_httpd_log to 'off' or 'on'. The default + is to use the native log format since it includes useful + information that Squid-specific log analysers use. The extended + version includes the referer and user-agent fields. + + emulate_extended_httpd_log off + DOC_END + + NAME: emulate_httpd_log COMMENT: on|off TYPE: onoff diff -r -c ../squid-2.2.STABLE4/src/client_side.c ./src/client_side.c *** ../squid-2.2.STABLE4/src/client_side.c Mon May 10 11:00:40 1999 --- ./src/client_side.c Thu Aug 19 13:23:20 1999 *************** *** 661,666 **** --- 661,667 ---- http->al.http.method = request->method; http->al.http.version = request->http_ver; http->al.headers.request = xstrdup(mb.buf); + http->al.headers.request_hdr = &request->header; http->al.hier = request->hier; packerClean(&p); memBufClean(&mb); diff -r -c ../squid-2.2.STABLE4/src/structs.h ./src/structs.h *** ../squid-2.2.STABLE4/src/structs.h Fri Feb 19 16:35:36 1999 --- ./src/structs.h Thu Aug 19 13:20:44 1999 *************** *** 361,366 **** --- 361,367 ---- int source_ping; #endif int common_log; + int extended_log; int log_mime_hdrs; int log_fqdn; int announce; *************** *** 778,783 **** --- 779,785 ---- struct { char *request; char *reply; + HttpHeader *request_hdr; } headers; struct { const char *method_str;