From: Amos Jeffries Date: Fri, 27 Jun 2008 13:40:12 +0000 (-0600) Subject: Author: Alter X-Git-Tag: SQUID_3_0_STABLE8~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6e5f9deb8167db0583dcbabcf3844df56e3cfa3;p=thirdparty%2Fsquid.git Author: Alter Bug 2301: Regression: Log format request/reply size options MFC: logging HTTP-request size I've made patch to Squid 2.5-stable14 (r4), which enables logging of http-request size and/or total request+reply size. Patch extends 'logformat' option of squid.conf. '>st' and 'st' can be used to log request size and total size respectively. If 'st' is used instead of 'a %Ss/%03Hs %st %rm %ru %un %Sh/%v", LFT_REQUEST_VERSION}, {"rv", LFT_REQUEST_VERSION}, - /*{ ">st", LFT_REQUEST_SIZE_TOTAL }, */ + { ">st", LFT_REQUEST_SIZE_TOTAL }, /*{ ">sl", LFT_REQUEST_SIZE_LINE }, * / / * the request line "GET ... " */ /*{ ">sh", LFT_REQUEST_SIZE_HEADERS }, */ /*{ ">sb", LFT_REQUEST_SIZE_BODY }, */ @@ -503,6 +504,7 @@ struct logformat_token_table_entry logformat_token_table[] = /*{ "http.version.major, (int) al->http.version.minor); - out = tmp; + break; + case LFT_REQUEST_SIZE_TOTAL: + outint = al->cache.requestSize; + dooff = 1; break; - /*case LFT_REQUEST_SIZE_TOTAL: */ /*case LFT_REQUEST_SIZE_LINE: */ /*case LFT_REQUEST_SIZE_HEADERS: */ /*case LFT_REQUEST_SIZE_BODY: */ /*case LFT_REQUEST_SIZE_BODY_NO_TE: */ case LFT_REPLY_SIZE_TOTAL: - outoff = al->cache.size; - + outoff = al->cache.replySize; dooff = 1; - break; case LFT_REPLY_HIGHOFFSET: @@ -822,6 +824,11 @@ accessLogCustom(AccessLogEntry * al, customlog * log) break; + case LFT_IO_SIZE_TOTAL: + outint = al->cache.requestSize + al->cache.replySize; + doint = 1; + break; + case LFT_EXT_LOG: if (al->request) out = al->request->extacl_log.buf(); @@ -1303,7 +1310,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile) client, log_tags[al->cache.code], al->http.code, - al->cache.size, + al->cache.replySize, al->_private.method_str, al->url, user ? user : dash_str, @@ -1321,7 +1328,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile) client, log_tags[al->cache.code], al->http.code, - al->cache.size, + al->cache.replySize, al->_private.method_str, al->url, user ? user : dash_str, @@ -1362,7 +1369,7 @@ accessLogCommon(AccessLogEntry * al, Logfile * logfile) al->url, al->http.version.major, al->http.version.minor, al->http.code, - al->cache.size, + al->cache.replySize, log_tags[al->cache.code], hier_strings[al->hier.code]); diff --git a/src/cf.data.pre b/src/cf.data.pre index 6502ccf72e..dc5d262b3c 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2008,6 +2008,8 @@ DOC_START et Tag returned by external acl ea Log string returned by external acl st Request size including HTTP headers + st Request+Reply size including HTTP headers http.method = request->method; aLogEntry->http.version = request->http_ver; aLogEntry->hier = request->hier; - + aLogEntry->cache.requestSize += request->content_length; aLogEntry->cache.extuser = request->extacl_user.buf(); if (request->auth_user_request) { @@ -495,7 +495,9 @@ ClientHttpRequest::logRequest() al.cache.caddr = getConn() != NULL ? getConn()->log_addr : no_addr; - al.cache.size = out.size; + al.cache.requestSize = req_sz; + + al.cache.replySize = out.size; al.cache.highOffset = out.offset; diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 9ee1c1a9df..4ebc42f181 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -179,7 +179,7 @@ icpLogIcp(struct IN_ADDR caddr, log_type logcode, int len, const char *url, int al.cache.caddr = caddr; - al.cache.size = len; + al.cache.replySize = len; al.cache.code = logcode;