Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat: how to log request(ed) domain?

Tags:

logging

tomcat

We have multiple domains pointing to our Tomcat web application which are all served by our default Host:

<Host name="localhost" appBase="..." unpackWARs="true" autoDeploy="true">
  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="access_log." suffix=".txt" pattern="???" resolveHosts="false" />
  <Context path="" docBase="..." allowLinking="true" reloadable="true" />
</Host>

Which Valve pattern do I need to configure to see to which domain the request has been sent (i.e. which domain the user had entered into the web browser)?

like image 623
mstrap Avatar asked Dec 02 '25 09:12

mstrap


1 Answers

<Valve ... pattern="... &quot;%{Host}i&quot; ..." ... />

will do the job.

like image 70
mstrap Avatar answered Dec 04 '25 02:12

mstrap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!