Repository: trafficserver Updated Branches: refs/heads/master d52dcaddf -> 5ebaf4f8a
TS-4148 Add a log field for connection attempts made to origin Added a log field `sca` that outputs the number of connection attempts made to the origin server for the current transaction. This closes #437 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5ebaf4f8 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5ebaf4f8 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5ebaf4f8 Branch: refs/heads/master Commit: 5ebaf4f8ace33b55010d578d01ea938843549806 Parents: d52dcad Author: Daniel Xu <[email protected]> Authored: Mon Jan 25 20:55:12 2016 +0000 Committer: Leif Hedstrom <[email protected]> Committed: Tue Jan 26 16:31:32 2016 -0700 ---------------------------------------------------------------------- doc/admin-guide/monitoring/logging/log-formats.en.rst | 6 ++++++ proxy/logging/Log.cc | 5 +++++ proxy/logging/LogAccess.cc | 8 ++++++++ proxy/logging/LogAccess.h | 1 + proxy/logging/LogAccessHttp.cc | 13 +++++++++++++ proxy/logging/LogAccessHttp.h | 1 + 6 files changed, 34 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/doc/admin-guide/monitoring/logging/log-formats.en.rst ---------------------------------------------------------------------- diff --git a/doc/admin-guide/monitoring/logging/log-formats.en.rst b/doc/admin-guide/monitoring/logging/log-formats.en.rst index 3fb8a3f..ce55519 100644 --- a/doc/admin-guide/monitoring/logging/log-formats.en.rst +++ b/doc/admin-guide/monitoring/logging/log-formats.en.rst @@ -708,6 +708,12 @@ The following list describes |TS| custom logging fields. Indicates whether the connection from |TS| to the origin was over SSL or not. +.. _sca: + +``sca`` + The number of attempts in the transaction Traffic Server tries to + connect to the origin server. + .. _shi: ``shi`` http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/proxy/logging/Log.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index dfd0bfd..bbad5be 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -714,6 +714,11 @@ Log::init_fields() global_field_list.add(field, false); ink_hash_table_insert(field_symbol_hash, "sstc", field); + field = new LogField("server_connect_attempts", "sca", LogField::sINT, &LogAccess::marshal_server_connect_attempts, + &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + ink_hash_table_insert(field_symbol_hash, "sca", field); + field = new LogField("cached_resp_status_code", "csssc", LogField::sINT, &LogAccess::marshal_cache_resp_status_code, &LogAccess::unmarshal_http_status); global_field_list.add(field, false); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/proxy/logging/LogAccess.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index 69e454a..e528002 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -558,6 +558,14 @@ LogAccess::marshal_server_transact_count(char *buf) } /*------------------------------------------------------------------------- +-------------------------------------------------------------------------*/ +int +LogAccess::marshal_server_connect_attempts(char *buf) +{ + DEFAULT_INT_FIELD; +} + +/*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ int http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/proxy/logging/LogAccess.h ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index 27442ae..96be7f0 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -234,6 +234,7 @@ public: inkcoreapi virtual int marshal_server_resp_time_ms(char *); // INT inkcoreapi virtual int marshal_server_resp_time_s(char *); // INT inkcoreapi virtual int marshal_server_transact_count(char *); // INT + inkcoreapi virtual int marshal_server_connect_attempts(char *); // INT // // cache -> client fields http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/proxy/logging/LogAccessHttp.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index 3d12ebf..c3c24c2 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -1143,6 +1143,19 @@ LogAccessHttp::marshal_server_transact_count(char *buf) -------------------------------------------------------------------------*/ int +LogAccessHttp::marshal_server_connect_attempts(char *buf) +{ + if (buf) { + int64_t attempts = m_http_sm->t_state.current.attempts; + marshal_int(buf, attempts); + } + return INK_MIN_ALIGN; +} + +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int LogAccessHttp::marshal_cache_resp_status_code(char *buf) { if (buf) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ebaf4f8/proxy/logging/LogAccessHttp.h ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h index 47677de..a4720f4 100644 --- a/proxy/logging/LogAccessHttp.h +++ b/proxy/logging/LogAccessHttp.h @@ -115,6 +115,7 @@ public: virtual int marshal_server_resp_time_ms(char *); // INT virtual int marshal_server_resp_time_s(char *); // INT virtual int marshal_server_transact_count(char *); // INT + virtual int marshal_server_connect_attempts(char *); // INT // // cache -> client fields
