2

With the Tomcat (8.0.15) access log valve, the default logging pattern is '%h %l %u %t "%r" %s %b'

I am using the SPNEGO filter to authenticate users.

The hello.jsp file with a simple request.getRemoteUser() does show my Windows username so the filter is working fine.

So I thought the %u would expand to the CGI variable REMOTE_USER but it just shows a blank.

I even tried using %{REMOTE_USER}i and %{REMOTE_USER}s and %{REMOTE_USER}r but none of them end up showing the value in the access log.

I enabled the Extended Access Log Valve by adding

<Valve className="org.apache.catalina.valves.ExtendedAccessLogValve" directory="logs" prefix="extended_access_log" suffix=".txt" pattern="c-ip x-H(remoteUser) date time cs-method cs-uri cs-uri-query cs-uri-stem sc-status bytes" />

in conf/server.xml but still no go.

Here is what I get in my extended access log

xx.xx.xx.xx - 2014-11-25 19:55:43 GET /hello.jsp - /hello.jsp 200 102

and in my access log

xx.xx.xx.xx - - - [25/Nov/2014:14:55:43 -0500] "GET /hello.jsp HTTP/1.1" 200 102

What am I missing? Is this a timing issue? The filter is setting REMOTE_USER after the access log entry is written?

Any help appreciated.

Thanks

partlycloudy
  • 419
  • 1
  • 4
  • 12
  • I'm not 100% sure but I'm betting that, yes, the logging is happening before the filter is applied. This happens when using Spring Security as well. See https://stackoverflow.com/a/31350895/225217 – Brice Roncace Dec 06 '22 at 21:56

0 Answers0