Renoise

warning: Creating default object from empty value in /home/pulsar/webroot/htdocs/modules/taxonomy/taxonomy.pages.inc on line 33.

Live Coding Session

I'll be doing some work in java for renoise.com today. If you would like to peek across my shoulder - http://live.yahoo.com/codewut

Combined Access Log Format for a proxed Tomcat

If you need to let your Tomcat write access logs while being proxied by Apache's mod_proxy using the combined format, you will soon notice the lack of the client IP address. Pretty useless if you would like to get some access statistics for that particular instance.

Fortunately the Apache's mod_proxy will add some extra headers with the missing information to each request. Just set up your Log-Configuration in Tomcat as follows:

  1. <Context>
  2. <Valve
  3. className="org.apache.catalina.valves.AccessLogValve"
  4. prefix="access_log"
  5. pattern="%{X-Forwarded-For}i %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
  6. rotatable="false"/>
  7. </Context>

Please note that I'm rotating the Tomcat logs using logrotate. Therefore the "rotatable" attribute is set to "false" above. Just in any case, here is the logrotate config for my setup:

  1. /home/tomcat/logs/*_log
  2. {
  3. weekly
  4. rotate 48
  5. create 640 tomcat www-data
  6. sharedscripts
  7. postrotate /etc/init.d/tomcat restart
  8. endscript
  9. compress
  10. }
Syndicate content