Vote Obama/Biden 2008 - Together We Can!
 

fak3r

dim high beams for oncoming traffic


HOWTO: log the user’s IP, not the proxy’s, in Lighttpd access log

Lighttpd - fly lightWhen you run a webserver behind a or like Squid or Varnish, the webserver access logs will display the of the proxy (generally 127.0.0.1) instead of the end user’s .  This not only breaks any kind of tracking or reporting you want to run against your webserver logs, but it also takes away a datapoint I’ve had use for in general server admin tasks. This server runs in front of Lighttpd, and it reveals the end user’s in the header as , so it’s just a matter of making () use that variable in its access logs instead of the default variable defining the . Once we know that, the configuration is simple; in .conf, enter this:

accesslog.format = "%{}i %l %u %t \"%r\" %>s %b /
\"%{Referer}i\" \"%{User-Agent}i\""

For the definition of these variables, and plenty more, hit Lighty’s wiki. Props to the poster on the mailing list for bringing this up and reminding me to fix it! I’ve sent this link to the list so now it’s out there.


  • Recent Comment

    • MikeG: I do consulting and have no paid holidays etc. So I figure on 47 weeks a year. This allows for holidays I am...
    • sapien1980: good post! thanks :)
    • fak3r: @Shawn Certainly that would be more accurate, my orginal post was more of a use if you were trying to figure...
    • fak3r: –AZ-Sen: Jon Kyl –AZ-01: Rick Renzi –AZ-05: J.D. Hayworth –CA-04: John Doolittle...
    • assisted living: this is awesome…i will grow old and get drunk