diff --git a/doc/admin/event-logging-formats.en.rst b/doc/admin/event-logging-formats.en.rst index 31ab2a1c641..4e70b4389c0 100644 --- a/doc/admin/event-logging-formats.en.rst +++ b/doc/admin/event-logging-formats.en.rst @@ -511,6 +511,13 @@ The following list describes Traffic Server custom logging fields. ``sts`` The time Traffic Server spends accessing the origin, in seconds. +.. _sstc: + +``sstc`` + The number of transactions between Traffic Server and the origin server + from a single server session. A value greater than 0 indicates connection + reuse. + .. _ttms: ``ttms`` diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index df369d8e0fb..f80ebdcc5fa 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -278,8 +278,9 @@ HttpSM::HttpSM() server_response_hdr_bytes(0), server_response_body_bytes(0), client_response_hdr_bytes(0), client_response_body_bytes(0), cache_response_hdr_bytes(0), cache_response_body_bytes(0), pushed_response_hdr_bytes(0), pushed_response_body_bytes(0), client_tcp_reused(false), client_ssl_reused(false), client_connection_is_ssl(false), client_sec_protocol("-"), - client_cipher_suite("-"), plugin_tag(0), plugin_id(0), hooks_set(false), cur_hook_id(TS_HTTP_LAST_HOOK), cur_hook(NULL), - cur_hooks(0), callout_state(HTTP_API_NO_CALLOUT), terminate_sm(false), kill_this_async_done(false), parse_range_done(false) + client_cipher_suite("-"), server_transact_count(0), plugin_tag(0), plugin_id(0), hooks_set(false), cur_hook_id(TS_HTTP_LAST_HOOK), + cur_hook(NULL), cur_hooks(0), callout_state(HTTP_API_NO_CALLOUT), terminate_sm(false), kill_this_async_done(false), + parse_range_done(false) { memset(&history, 0, sizeof(history)); memset(&vc_table, 0, sizeof(vc_table)); @@ -5609,7 +5610,7 @@ HttpSM::attach_server_session(HttpServerSession *s) hsm_release_assert(server_entry == NULL); hsm_release_assert(s->state == HSS_ACTIVE); server_session = s; - server_session->transact_count++; + server_transact_count = server_session->transact_count++; // Set the mutex so that we have something to update // stats with diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index 605341d71ae..c374905dd8a 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -499,6 +499,7 @@ class HttpSM : public Continuation bool client_connection_is_ssl; const char *client_sec_protocol; const char *client_cipher_suite; + int server_transact_count; TransactionMilestones milestones; ink_hrtime api_timer; diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index cad013e90c9..d2c7694ed61 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -705,6 +705,11 @@ Log::init_fields() global_field_list.add(field, false); ink_hash_table_insert(field_symbol_hash, "sts", field); + field = new LogField("server_transact_count", "sstc", LogField::sINT, &LogAccess::marshal_server_transact_count, + &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + ink_hash_table_insert(field_symbol_hash, "sstc", 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); diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index 8264c47c8fa..a671a596a1e 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -541,6 +541,13 @@ LogAccess::marshal_server_resp_time_s(char *buf) DEFAULT_INT_FIELD; } +/*------------------------------------------------------------------------- +-------------------------------------------------------------------------*/ +int +LogAccess::marshal_server_transact_count(char *buf) +{ + DEFAULT_INT_FIELD; +} /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index 45459c6684f..8eabc73cb0d 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -232,6 +232,7 @@ class LogAccess inkcoreapi virtual int marshal_server_resp_http_version(char *); // INT 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 // // cache -> client fields diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index ba8b7dec542..711df25740b 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -1096,6 +1096,20 @@ LogAccessHttp::marshal_server_resp_time_s(char *buf) return INK_MIN_ALIGN; } +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int +LogAccessHttp::marshal_server_transact_count(char *buf) +{ + if (buf) { + int64_t count; + count = m_http_sm->server_transact_count; + marshal_int(buf, count); + } + return INK_MIN_ALIGN; +} + /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h index 20a4ea6d205..9ce0e71ef69 100644 --- a/proxy/logging/LogAccessHttp.h +++ b/proxy/logging/LogAccessHttp.h @@ -113,6 +113,7 @@ class LogAccessHttp : public LogAccess virtual int marshal_server_resp_http_version(char *); // INT 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 // // cache -> client fields