From: Henrik Nordström Date: Thu, 3 Jun 2010 07:49:20 +0000 (+0200) Subject: Author: Tsantilas Christos X-Git-Tag: SQUID_3_2_0_1~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=152e24b3cd7b46243f9cc8dd92f8dddd93f62ce0;p=thirdparty%2Fsquid.git Author: Tsantilas Christos Add logging of the local TCP port used by transactions with http servers The new log format code is "%local_port is often cached. + request->hier.peer_local_port = comm_local_port(fd); + dispatch(); return; @@ -895,6 +898,8 @@ FwdState::connectStart() if (!fs->_peer) origin_tries++; + request->hier.peer_local_port = comm_local_port(fd); + /* * stats.conn_open is used to account for the number of * connections that we have open to the peer, so we can limit diff --git a/src/log/access_log.cc b/src/log/access_log.cc index 436b57f73e..b8a4b3e691 100644 --- a/src/log/access_log.cc +++ b/src/log/access_log.cc @@ -344,6 +344,7 @@ typedef enum { LFT_LOCAL_IP, LFT_LOCAL_PORT, /*LFT_LOCAL_NAME, */ + LFT_PEER_LOCAL_PORT, LFT_TIME_SECONDS_SINCE_EPOCH, LFT_TIME_SUBSECOND, @@ -505,6 +506,7 @@ struct logformat_token_table_entry logformat_token_table[] = { {"la", LFT_LOCAL_IP}, {"lp", LFT_LOCAL_PORT}, /*{ "lA", LFT_LOCAL_NAME }, */ + {"hier.peer_local_port) { + outint = al->hier.peer_local_port; + doint = 1; + } + + break; + case LFT_TIME_SECONDS_SINCE_EPOCH: // some platforms store time in 32-bit, some 64-bit... outoff = static_cast(current_time.tv_sec); @@ -2081,7 +2091,8 @@ HierarchyLogEntry::HierarchyLogEntry() : n_ichoices(0), peer_reply_status(HTTP_STATUS_NONE), peer_response_time(-1), - total_response_time(-1) + total_response_time(-1), + peer_local_port(0) { memset(host, '\0', SQUIDHOSTNAMELEN); memset(cd_host, '\0', SQUIDHOSTNAMELEN);