Skip to content

Add cache key hash logging field and public API#13134

Open
zwoop wants to merge 1 commit intoapache:masterfrom
zwoop:CacheKeyLog
Open

Add cache key hash logging field and public API#13134
zwoop wants to merge 1 commit intoapache:masterfrom
zwoop:CacheKeyLog

Conversation

@zwoop
Copy link
Copy Markdown
Contributor

@zwoop zwoop commented May 1, 2026

Add 'ckh' log field that emits the base64-encoded cache key digest, and TSHttpTxnCacheKeyDigestGet() for plugin access to the raw hash bytes. Includes admin and API documentation.

Co-Author: Craig Taylor

@zwoop zwoop added this to the 11.0.0 milestone May 1, 2026
@zwoop zwoop requested review from bneradt and Copilot May 1, 2026 18:47
@zwoop zwoop self-assigned this May 1, 2026
@zwoop
Copy link
Copy Markdown
Contributor Author

zwoop commented May 1, 2026

The use of this new log tag is primarily when the cachekey (or other plugins) modifies the cache key beyond what's in the URL. This allows for data analysis using the unique / identifiable value of the cache key, without spilling any secrets or details into the logs.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds visibility into the cache key digest by introducing a new access log field (ckh) and a new public plugin API to retrieve the raw cache key hash bytes for a transaction, along with accompanying documentation and a gold test update.

Changes:

  • Add ckh log field that base64-encodes the effective cache key digest.
  • Add TSHttpTxnCacheKeyDigestGet() public API for plugins to retrieve the raw digest bytes.
  • Update admin/API docs and extend the existing milestone logging gold test to validate ckh.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/gold_tests/logging/verify_milestone_fields.py Extends validation to require a base64 ckh field and ensure it’s stable across miss/hit.
tests/gold_tests/logging/log-milestone-fields.test.py Adds ckh to the custom log format used by the gold test.
src/proxy/logging/TransactionLogData.cc Exposes the transaction cache key hash to the logging layer via a new accessor.
src/proxy/logging/LogAccess.cc Implements marshalling for ckh by base64-encoding the cache key digest.
src/proxy/logging/Log.cc Registers the new ckh log field.
src/api/InkAPI.cc Implements the new plugin API TSHttpTxnCacheKeyDigestGet().
include/ts/ts.h Declares and documents TSHttpTxnCacheKeyDigestGet().
include/proxy/logging/TransactionLogData.h Declares the new get_cache_lookup_hash() accessor.
include/proxy/logging/LogAccess.h Declares marshal_cache_key_hash().
include/proxy/http/HttpCacheSM.h Adds HttpCacheSM::get_cache_key() accessor needed by logging/API.
doc/developer-guide/api/functions/TSHttpTxnCacheKeyDigestGet.en.rst Adds developer documentation for the new API function.
doc/admin-guide/logging/formatting.en.rst Documents the new ckh access log field.

Comment thread src/api/InkAPI.cc
Comment thread tests/gold_tests/logging/verify_milestone_fields.py
Add 'ckh' log field that emits the base64-encoded cache key
digest, and TSHttpTxnCacheKeyDigestGet() for plugin access to
the raw hash bytes. Includes admin and API documentation.

Co-Author: Craig Taylor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants