You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by rr...@apache.org on 2018/07/23 19:48:33 UTC
[trafficserver] branch master updated: Adds new logging tags: nhi
and nhp
This is an automated email from the ASF dual-hosted git repository.
rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 74f03c7 Adds new logging tags: nhi and nhp
74f03c7 is described below
commit 74f03c78b24a524750080c53d6a6fa3c9b262a4b
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Mon Jul 23 10:59:02 2018 -0700
Adds new logging tags: nhi and nhp
next-hop-ip (nhi) is the IP of the next hop
next-hop-port (nhp) is the port of the next hop
Uses the original logic that pqsi used for marshalling
(pre 01201739e252f84e7c8a7c62c0ee31feb0def616)
---
doc/admin-guide/logging/formatting.en.rst | 4 ++++
proxy/logging/Log.cc | 8 ++++++++
proxy/logging/LogAccess.cc | 13 +++++++++++++
proxy/logging/LogAccess.h | 2 ++
proxy/logging/LogAccessHttp.cc | 16 ++++++++++++++++
proxy/logging/LogAccessHttp.h | 2 ++
6 files changed, 45 insertions(+)
diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst
index 93c8ee8..baecf9c 100644
--- a/doc/admin-guide/logging/formatting.en.rst
+++ b/doc/admin-guide/logging/formatting.en.rst
@@ -447,6 +447,8 @@ Network Addresses, Ports, and Interfaces
.. _pqsp:
.. _shi:
.. _shn:
+.. _nhi:
+.. _nhp:
The following log fields are used to log details of the network (IP) addresses,
incoming/outgoing ports, and network interfaces used during transactions.
@@ -471,6 +473,8 @@ shi Origin Server IP address resolved via DNS by |TS| for the origin server.
|TS| for the connection will be reported. See note below
regarding misleading values from cached documents.
shn Origin Server Host name of the origin server.
+nhi Origin Server Destination IP address of next hop
+nhp Origin Server Destination port of next hop
===== ============== ==========================================================
.. note::
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 81d24a0..753516b 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -677,6 +677,14 @@ Log::init_fields()
global_field_list.add(field, false);
ink_hash_table_insert(field_symbol_hash, "pqsp", field);
+ field = new LogField("next_hop_ip", "nhi", LogField::IP, &LogAccess::marshal_next_hop_ip, &LogAccess::unmarshal_ip_to_str);
+ global_field_list.add(field, false);
+ ink_hash_table_insert(field_symbol_hash, "nhi", field);
+
+ field = new LogField("next_hop_port", "nhp", LogField::IP, &LogAccess::marshal_next_hop_port, &LogAccess::unmarshal_int_to_str);
+ global_field_list.add(field, false);
+ ink_hash_table_insert(field_symbol_hash, "nhp", field);
+
Ptr<LogFieldAliasTable> hierarchy_map = make_ptr(new LogFieldAliasTable);
hierarchy_map->init(
36, SQUID_HIER_EMPTY, "EMPTY", SQUID_HIER_NONE, "NONE", SQUID_HIER_DIRECT, "DIRECT", SQUID_HIER_SIBLING_HIT, "SIBLING_HIT",
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index fdaf3f3..505e60b 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -303,6 +303,19 @@ LOG_ACCESS_DEFAULT_FIELD(marshal_proxy_req_server_port, DEFAULT_INT_FIELD)
LOG_ACCESS_DEFAULT_FIELD(marshal_proxy_hierarchy_route, DEFAULT_INT_FIELD)
+/*-------------------------------------------------------------------------
+ -------------------------------------------------------------------------*/
+
+LOG_ACCESS_DEFAULT_FIELD(marshal_next_hop_ip, DEFAULT_IP_FIELD)
+
+/*-------------------------------------------------------------------------
+ -------------------------------------------------------------------------*/
+
+LOG_ACCESS_DEFAULT_FIELD(marshal_next_hop_port, DEFAULT_INT_FIELD)
+
+/*-------------------------------------------------------------------------
+ -------------------------------------------------------------------------*/
+
LOG_ACCESS_DEFAULT_FIELD(marshal_client_retry_after_time, DEFAULT_INT_FIELD)
/*-------------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 700492d..bfcefb4 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -223,6 +223,8 @@ public:
inkcoreapi virtual int marshal_proxy_req_server_ip(char *); // INT
inkcoreapi virtual int marshal_proxy_req_server_port(char *); // INT
inkcoreapi virtual int marshal_proxy_hierarchy_route(char *); // INT
+ inkcoreapi virtual int marshal_next_hop_ip(char *); // STR
+ inkcoreapi virtual int marshal_next_hop_port(char *); // INT
inkcoreapi virtual int marshal_proxy_host_name(char *); // STR
inkcoreapi virtual int marshal_proxy_host_ip(char *); // STR
inkcoreapi virtual int marshal_proxy_req_is_ssl(char *); // INT
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index 6c52117..1234c32 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -1102,6 +1102,22 @@ LogAccessHttp::marshal_proxy_req_server_port(char *buf)
return INK_MIN_ALIGN;
}
+int
+LogAccessHttp::marshal_next_hop_ip(char *buf)
+{
+ return marshal_ip(buf, m_http_sm->t_state.current.server != nullptr ? &m_http_sm->t_state.current.server->dst_addr.sa : nullptr);
+}
+
+int
+LogAccessHttp::marshal_next_hop_port(char *buf)
+{
+ if (buf) {
+ uint16_t port = ntohs(m_http_sm->t_state.current.server != nullptr ? m_http_sm->t_state.current.server->dst_addr.port() : 0);
+ marshal_int(buf, port);
+ }
+ return INK_MIN_ALIGN;
+}
+
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
index bc1b84d..d0cadec 100644
--- a/proxy/logging/LogAccessHttp.h
+++ b/proxy/logging/LogAccessHttp.h
@@ -110,6 +110,8 @@ public:
int marshal_proxy_hierarchy_route(char *) override; // INT
int marshal_proxy_host_port(char *) override; // INT
int marshal_proxy_req_is_ssl(char *) override; // INT
+ int marshal_next_hop_ip(char *) override; // STR
+ int marshal_next_hop_port(char *) override; // INT
//
// server -> proxy fields