Skip to content

Comments

Add support for custom logging field#12872

Open
maskit wants to merge 25 commits intoapache:masterfrom
maskit:log_custom_field
Open

Add support for custom logging field#12872
maskit wants to merge 25 commits intoapache:masterfrom
maskit:log_custom_field

Conversation

@maskit
Copy link
Member

@maskit maskit commented Feb 10, 2026

This adds a new TS API, TSLogFieldRegister, which I proposed on the list.

@bneradt
Copy link
Contributor

bneradt commented Feb 11, 2026

[approve ci autest 1]

Copy link
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 pull request adds support for custom logging fields in Apache Traffic Server, allowing plugins to register new log fields or replace existing ones. The implementation introduces a new lifecycle hook TS_LIFECYCLE_LOG_INITIALIZED_HOOK that fires after the logging system initializes but before the logging configuration loads, giving plugins an opportunity to register custom fields.

Changes:

  • Introduces a new lifecycle hook and event for log field customization
  • Adds public API functions for registering custom log fields and helper marshal/unmarshal functions
  • Refactors logging initialization to separate field initialization from configuration loading
  • Provides a complete example plugin demonstrating the feature

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
src/traffic_server/traffic_server.cc Invokes the new lifecycle hook after logging initialization but before config loading
src/proxy/logging/LogField.cc Adds constructor for custom fields and updates marshal/unmarshal logic
include/proxy/logging/LogField.h Defines CustomMarshalFunc and CustomUnmarshalFunc types
src/proxy/logging/LogAccess.cc Implements custom field marshaling wrapper
src/proxy/logging/Log.cc Separates field initialization from config loading by introducing load_config()
src/api/InkAPI.cc Implements TSLogFieldRegister and helper marshal/unmarshal functions
include/ts/ts.h Declares public API functions
include/ts/apidefs.h.in Adds lifecycle hook/event enums and TSLogType enum
example/plugins/c-api/custom_logfield/custom_logfield.cc Example plugin demonstrating custom log field usage
example/plugins/c-api/CMakeLists.txt Adds custom_logfield plugin to build
doc/developer-guide/api/types/TSEvent.en.rst Documents new lifecycle event
doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst Documents new lifecycle hook
doc/developer-guide/api/functions/TSLogFieldRegister.en.rst Comprehensive API documentation for custom log fields

@maskit maskit self-assigned this Feb 17, 2026
@maskit maskit added this to the 11.0.0 milestone Feb 17, 2026
@maskit maskit marked this pull request as ready for review February 17, 2026 21:06
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