tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: VS: Tomcat accesslogs / Geoserver
Date Wed, 04 Oct 2017 00:54:10 GMT
Hash: SHA256


On 10/3/17 1:40 AM, Jussila Ville wrote:
> Thanks for your fast answer.
> I'm quite new with Tomcat and HTTP. But as you said, Geoserver is 
> taking care of the authentication itself. So this is the problem
> and we are not able to log the username in the access logs. I think
> we have to focus then on the Geoserver own logging.

I have an idea for you, and it will only work because of the use of
HTTP Basic authentication.

With HTTP Basic, the username and password are present in every HTTP
request. Just because Tomcat is ignoring them doesn't mean you have to
ignore them.

You can log the incoming HTTP header WWW-Authenticate and you'll
capture the user's username. Unfortunately, you'll also capture their
password, which is a REALLY BAD THING TO DO in a log file like that.
But that might be the beginning of a solution.

Tomcat's access log component is a Valve, which means it runs before
any Filters. If you wrote a Valve to parse the WWW-Authenticate header
and place the user's username in a request parameter, you could log
that using the AccessLogValve.

The Valve will be relatively simple to write, but it does require that
you compile it against the Tomcat API itself, and then deploy the
Valve at the server level instead of in your application.

Hope that helps,
- -chris

> -----Alkuperäinen viesti----- Lähettäjä: Christopher Schultz
> [] Lähetetty: 2. lokakuuta 2017
> 17:31 Vastaanottaja: Aihe: Re: Tomcat
> accesslogs / Geoserver
> Jussila,
> On 10/2/17 9:18 AM, Jussila Ville wrote:
>> We are running Geoserver 2.11.1 with Java 1.8.0_131 on Tomcat
>> 8.0.44.
>> I have tried before Geoserver's own mailing list without any
>> help, so now I try this one. Geoserver is a map engine to publish
>> raster and vector data in the Internet. More information can be
>> found here
>> We are not able to record the username in the Tomcat Accesslog. 
>> Geoserver has it's monitor plugin and Auditlogs, which we have 
>> installed and logs are running nicely with recorded username. In
>> the Tomcat's accesslog they don't show up no matter what I try.
>> We prefer more using Tomcat's access logs, as we are not
>> satisfied Geoservers format.
>> Here are parameters for the AccessLogValve in Tomcat 
>> 8.0\conf\server.xml file
>> <Valve className="org.apache.catalina.valves.AccessLogValve" 
>> directory="D:\Data\GeoServer\Tomcat_logs" 
>> prefix="localhost_access_log" suffix=".txt" pattern="%a 
>> %{X-Forwarded-FOR}i %u %t &quot;%r&quot; %s %b" />
>> I have tried to replace "%u" parameter with different kinds of 
>> syntaxes example "%{username}s", "%{userName}s",
>> "%{remoteUser}s", "%{remoteuser}s", but none of them had solved
>> the problem. Not even replacing "s" with "i". With
>> {Authorization}i, I was able to record that Geoserver is using
>> Basic authentication as it is set in UI.
>> Can you help me?
> Is it possible that Geoserver is using its own built-in HTTP Basic
> authentication instead of having Tomcat handle authentication? If
> so, Tomcat knows nothing about the user, etc. and can't log
> anything about them in the access log.
> -chris
> ---------------------------------------------------------------------
To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
To unsubscribe, e-mail:
> For additional commands, e-mail:
Comment: GPGTools -
Comment: Using GnuPG with Thunderbird -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message