Add support for custom logging field#12872
Open
maskit wants to merge 25 commits intoapache:masterfrom
Open
Conversation
Contributor
|
[approve ci autest 1] |
Contributor
There was a problem hiding this comment.
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 |
bneradt
approved these changes
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new TS API, TSLogFieldRegister, which I proposed on the list.