[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Conditional access logs
From:       Chris Cheshire <yahoonomas () gmail ! com>
Date:       2022-04-25 17:34:26
Message-ID: 0253DE32-3E55-44B9-994C-522A9A9393F1 () gmail ! com
[Download RAW message or body]



> On Apr 22, 2022, at 1:32 PM, Tim Funk <funkman@apache.org> wrote:
> 
> 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


Good to know. I'm going to try the logback route first - if that fails I'll look at \
an enhancement request or patch.

Chris


> 
> 
> > On Thu, Apr 21, 2022 at 5:08 PM Chris Cheshire <yahoonomas@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?
> > 
> > 
> > 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic