Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/admin-guide/logging/formatting.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ Cache Details
.. _chm:
.. _cwr:
.. _cwtr:
.. _crra:
.. _cwra:
.. _cccs:

These log fields reveal details of the |TS| proxy interaction with its own
cache while attempting to service incoming client requests.
Expand All @@ -173,6 +176,13 @@ cwr Proxy Cache Cache Write Result. Specifies the result of attempting to
(``WL_MISS``), write interrupted (``INTR``), error while
writing (``ERR``), or cache write successful (``FIN``).
cwt Proxy Cache Cache Write Transform Result.
crra Proxy Cache Cache read retry attempts to read the object from cache.
cwra Proxy Cache Cache write retry attempts to write a fresh or updated
object to cache.
cccs Proxy Cache Cache collapsed connection success;
-1: collapsing was attempted but failed, request went upstream
0: collapsing was unnecessary
1: attempted to collapse and got a cache hit on subsequent read attempts
===== ============== ==========================================================

.. _admin-logging-fields-txn:
Expand Down
15 changes: 15 additions & 0 deletions proxy/logging/Log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,21 @@ Log::init_fields()
global_field_list.add(field, false);
field_symbol_hash.emplace("ctid", field);

field = new LogField("cache_read_retry_attempts", "crra", LogField::dINT, &LogAccess::marshal_cache_read_retries,
&LogAccess::unmarshal_int_to_str);
global_field_list.add(field, false);
field_symbol_hash.emplace("crra", field);

field = new LogField("cache_write_retry_attempts", "cwra", LogField::dINT, &LogAccess::marshal_cache_write_retries,
&LogAccess::unmarshal_int_to_str);
global_field_list.add(field, false);
field_symbol_hash.emplace("cwra", field);

field = new LogField("cache_collapsed_connection_success", "cccs", LogField::dINT,
&LogAccess::marshal_cache_collapsed_connection_success, &LogAccess::unmarshal_int_to_str);
global_field_list.add(field, false);
field_symbol_hash.emplace("cccs", field);

field = new LogField("client_transaction_priority_weight", "ctpw", LogField::sINT,
&LogAccess::marshal_client_http_transaction_priority_weight, &LogAccess::unmarshal_int_to_str);
global_field_list.add(field, false);
Expand Down
55 changes: 55 additions & 0 deletions proxy/logging/LogAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2631,6 +2631,61 @@ LogAccess::marshal_client_http_transaction_priority_dependence(char *buf)
return INK_MIN_ALIGN;
}

/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/

int
LogAccess::marshal_cache_read_retries(char *buf)
{
if (buf) {
int64_t id = 0;
if (m_http_sm) {
id = m_http_sm->get_cache_sm().get_open_read_tries();
}
marshal_int(buf, id);
}
return INK_MIN_ALIGN;
}

/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/

int
LogAccess::marshal_cache_write_retries(char *buf)
{
if (buf) {
int64_t id = 0;
if (m_http_sm) {
id = m_http_sm->get_cache_sm().get_open_write_tries();
}
marshal_int(buf, id);
}
return INK_MIN_ALIGN;
}

int
LogAccess::marshal_cache_collapsed_connection_success(char *buf)
{
if (buf) {
int64_t id = 0; // default - no collapse attempt
if (m_http_sm) {
SquidLogCode code = m_http_sm->t_state.squid_codes.log_code;

// We increment open_write_tries beyond the max when we want to jump back to the read state for collapsing
if ((m_http_sm->get_cache_sm().get_open_write_tries() > (m_http_sm->t_state.txn_conf->max_cache_open_write_retries)) &&
((code == SQUID_LOG_TCP_HIT) || (code == SQUID_LOG_TCP_MEM_HIT) || (code == SQUID_LOG_TCP_DISK_HIT))) {
// Attempted collapsed connection and got a hit, success
id = 1;
} else if (m_http_sm->get_cache_sm().get_open_write_tries() > (m_http_sm->t_state.txn_conf->max_cache_open_write_retries)) {
// Attempted collapsed connection with no hit, failure, we can also get +2 retries in a failure state
id = -1;
}
}

marshal_int(buf, id);
}
return INK_MIN_ALIGN;
}
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/

Expand Down
3 changes: 3 additions & 0 deletions proxy/logging/LogAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ class LogAccess
inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR
inkcoreapi int marshal_client_sni_server_name(char *); // STR
inkcoreapi int marshal_version_build_number(char *); // STR
inkcoreapi int marshal_cache_read_retries(char *); // INT
inkcoreapi int marshal_cache_write_retries(char *); // INT
inkcoreapi int marshal_cache_collapsed_connection_success(char *); // INT

// named fields from within a http header
//
Expand Down