Looks like an interesting feature. Thank you for working on it.

On Wed, Feb 11, 2026 at 3:22 PM Masakazu Kitajo <[email protected]> wrote:

> Hi all,
>
> I'd like to propose a new TS API to enable plugins to add or redefine
> access log fields.
>
> Use cases:
> - Log information that ATS core does not expose (e.g. information in a
> client certificate)
> - Log information from plugins (e.g. tcpinfo)
> - Redefine log fields (e.g. Fill cqpv field based on ALPN info in PROXY
> protocol header if available)
>
> API:
> TSReturnCode TSLogFieldRegister(
>   std::string_view name,
>   std::string_view symbol,
>   TSLogType type,
>   TSLogMarshalCallback marshal_cb,
>   TSLogUnmarshalCallback unmarshal_cb,
>   bool replace = false);
>
> The parameters are basically same as the constructor of the internal log
> field implementation (LogField). The only difference is the replace
> parameter. With the default value (false), the API call fails if there is
> already a log field that has the same symbol. It prevents accidental
> overriding due to symbol conflict. If the parameter is explicitly set to
> true, the API call replaces the existing log field registration with a new
> one. This is useful if you want to redefine log fields.
>
> Known Issue:
> An issue with custom fields is that tools like traffic_logstats do not
> know those custom fields. It's problematic especially if the log file
> format is binary. But as long as custom fields do not need special
> unmarshaling functions, a field definition file (maybe a map between a
> symbol and a type) should help those tools. And those custom fields do not
> harm anything until users put those fields into their log formats.
> Ideally, plugins that add complex custom fields should provide a library
> or pseudo code to unmarshal the fields so that tools can support those
> easily, but I think it's out of our control.
>
> Pull Request:
> https://github.com/apache/trafficserver/pull/12872
>
> Thoughts?
>
> Thanks,
> Masakazu
>


-- 
"Come to Me, all who are weary and heavy-laden, and I will
give you rest. Take My yoke upon you and learn from Me, for
I am gentle and humble in heart, and you will find rest for
your souls. For My yoke is easy and My burden is light."

    ~ Matthew 11:28-30

Reply via email to