I don't think there is a technical reason why it couldn't be added. I think
the hard part is getting the config wording/naming correct

Alternatively, I think an out of the box workaround could also be Tomcat's
RewriteValve where the condition matches on header and sets the
"environment variable"
https://tomcat.apache.org/tomcat-9.0-doc/rewrite.html

You can submit a feature enhancement request in the bug database
https://tomcat.apache.org/bugreport.html#How_to_submit_patches_and_enhancement_requests

-Tim


On Thu, Apr 21, 2022 at 5:08 PM Chris Cheshire <yahoono...@gmail.com> wrote:

> Tomcat 9.
>
> I wanted to separate out access logs for external api calls to log
> different info than the standard access log line. For example, the api key
> used which is set as a request header.
>
> Adding that to the pattern was easy.
>
> However the conditional logging was clunky. I found the ‘conditionIf’ and
> ‘conditionUnless’ attributes for the access log valve, but these only work
> on request attributes, not headers (at least that’s what the documentation
> says).
>
> I have created a filter that copies the values from the request headers to
> equivalent  attributes, just so the condition can work. This is where it
> feels  clunky, especially since the access log valve has replacement
> parameters for logging request headers.
>
> Is there a technical reason why the condition checking can’t work on
> request headers in the valve? If not, can this be considered as a feature
> request please?
>
>
>

Reply via email to