Created
March 22, 2016 16:01
-
-
Save williameliel/ce5131182f7c3b9d918a to your computer and use it in GitHub Desktop.
Add IP to apache log -varnish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_vcl add to vcl_recv func | |
if (req.restarts == 0) { | |
if (req.http.X-Forwarded-For) { | |
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip; | |
} else { | |
set req.http.X-Forwarded-For = client.ip; | |
} | |
} | |
Add this to httpd or apache2 conf | |
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined | |
Add this to vhost | |
CustomLog /var/log/httpd/www.abc.com/access.log varnishcombined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment