From: Amos Jeffries Date: Wed, 25 Jun 2008 12:21:03 +0000 (+1200) Subject: Author: Alter X-Git-Tag: SQUID_3_1_0_1~49^2~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a86db31764aa49ce40d644734e6a7b58350706a;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 }, */ @@ -493,6 +494,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: @@ -815,6 +817,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(); @@ -1299,7 +1306,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, @@ -1317,7 +1324,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, @@ -1361,7 +1368,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 fb42ce112d..0deeac21d4 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -2266,6 +2266,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) { @@ -501,7 +501,9 @@ ClientHttpRequest::logRequest() if(getConn() != NULL) al.cache.caddr = getConn()->log_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 9c534ff1aa..2c5b592cbf 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -194,7 +194,7 @@ icpLogIcp(const IPAddress &caddr, log_type logcode, int len, const char *url, in al.cache.caddr = caddr; - al.cache.size = len; + al.cache.replySize = len; al.cache.code = logcode;