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
