serrislew commented on code in PR #13018:
URL: https://github.com/apache/trafficserver/pull/13018#discussion_r3011284050
##########
doc/admin-guide/logging/formatting.en.rst:
##########
@@ -314,8 +314,27 @@ prior to the log field's name, as so::
Format = '%<{User-agent}cqh>'
The above would insert the User Agent string from the client request headers
-into your log entry (or a blank string if no such header was present, or it did
-not contain a value).
+into your log entry (or ``-`` if no such header was present).
+
+Header fields can also be chained with a fallback operator, `?:`, when you want
+the log to use the first header that exists. For example::
+
+ Format = '%<{x-primary-id}cqh?:{x-secondary-id}cqh>'
+
+|TS| evaluates the candidates from left to right and logs the first header that
+exists. If none of the headers exist, |TS| logs ``-``. A header that exists but
+has an empty value is considered present, so |TS| logs the empty value instead
+of falling back. So in the example above, the value of x-primary-id of the
+client request is logged if it exists, otherwise the value of x-secondary-id is
+logged if it exists, otherwise ``-`` is logged if neither of the headers is
+present.
+
+Note that this fallback chain feature is only supported for header field
Review Comment:
So `%<{x-primary-id}cqh?:Foo>` wouldn't be supported? I guess you can do a
workaround to make an internal header with value "Foo" and then use that
instead? `%<{x-primary-id}cqh?:{@Foo}>`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]