Repository: trafficserver Updated Branches: refs/heads/master 3caa12b9b -> 17b83c839
TS-3154: add proxy port access log tag as 'php' Added proxy port to access log. This closes #125. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/17b83c83 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/17b83c83 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/17b83c83 Branch: refs/heads/master Commit: 17b83c839edd8209179d78d38615715aae379d22 Parents: 3caa12b Author: Acácio Centeno <[email protected]> Authored: Mon Oct 27 09:57:17 2014 -0700 Committer: James Peach <[email protected]> Committed: Mon Oct 27 10:03:53 2014 -0700 ---------------------------------------------------------------------- CHANGES | 3 +++ doc/admin/event-logging-formats.en.rst | 5 +++++ proxy/logging/Log.cc | 7 +++++++ proxy/logging/LogAccess.cc | 6 ++++++ proxy/logging/LogAccess.h | 1 + proxy/logging/LogAccessHttp.cc | 12 ++++++++++++ proxy/logging/LogAccessHttp.h | 1 + 7 files changed, 35 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 0b833fb..90eaef3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.2.0 + *) [TS-3154] Add proxy port access log tag as 'php'. + Author: Acácio Centeno <[email protected]> + *) [TS-3152] stop offerring HTTP/2 over TLS by default. *) [TS-3060] Fix memory leak in cleaning up tunnel resources http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/doc/admin/event-logging-formats.en.rst ---------------------------------------------------------------------- diff --git a/doc/admin/event-logging-formats.en.rst b/doc/admin/event-logging-formats.en.rst index 50c5b0b..67f8dc1 100644 --- a/doc/admin/event-logging-formats.en.rst +++ b/doc/admin/event-logging-formats.en.rst @@ -294,6 +294,11 @@ The following list describes Traffic Server custom logging fields. The proxy hierarchy route; the route Traffic Server used to retrieve the object. +.. _php: + +``php`` + The TCP port number that Traffic Server served this request from. + .. _piid: ``piid`` http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/proxy/logging/Log.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index a207bec..75d5f0f 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -724,6 +724,13 @@ Log::init_fields() global_field_list.add(field, false); ink_hash_table_insert(field_symbol_hash, "phi", field); + field = new LogField("proxy_host_port", "php", + LogField::sINT, + &LogAccess::marshal_proxy_host_port, + &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + ink_hash_table_insert(field_symbol_hash, "php", field); + // server -> proxy fields field = new LogField("server_host_ip", "shi", http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/proxy/logging/LogAccess.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index 1197de2..cef23e1 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -546,6 +546,12 @@ LogAccess::marshal_http_header_field_escapify(LogField::Container /* container A DEFAULT_STR_FIELD; } +int +LogAccess::marshal_proxy_host_port(char *buf) +{ + DEFAULT_INT_FIELD; +} + /*------------------------------------------------------------------------- The following functions have a non-virtual base-class implementation. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/proxy/logging/LogAccess.h ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index 8fb35b5..b970750 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -196,6 +196,7 @@ public: inkcoreapi virtual int marshal_proxy_resp_header_len(char *); // INT inkcoreapi virtual int marshal_proxy_finish_status_code(char *); // INT inkcoreapi virtual int marshal_cache_result_code(char *); // INT + inkcoreapi virtual int marshal_proxy_host_port(char *); // INT // // proxy -> server fields http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/proxy/logging/LogAccessHttp.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index 91534f2..a1a673e 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -696,6 +696,18 @@ LogAccessHttp::marshal_proxy_finish_status_code(char *buf) } /*------------------------------------------------------------------------- +-------------------------------------------------------------------------*/ +int +LogAccessHttp::marshal_proxy_host_port(char *buf) +{ + if (buf) { + uint16_t port = m_http_sm->t_state.request_data.incoming_port; + marshal_int(buf, port); + } + return INK_MIN_ALIGN; +} + +/*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ int http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17b83c83/proxy/logging/LogAccessHttp.h ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h index 51ee9e3..14e8ce8 100644 --- a/proxy/logging/LogAccessHttp.h +++ b/proxy/logging/LogAccessHttp.h @@ -91,6 +91,7 @@ public: virtual int marshal_proxy_req_server_name(char *); // STR virtual int marshal_proxy_req_server_ip(char *); // INT virtual int marshal_proxy_hierarchy_route(char *); // INT + virtual int marshal_proxy_host_port(char *); // INT // // server -> proxy fields
