Loggear la ip del cliente en lugar de la del proxy de varnish
Configuración de Varnish:
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
# [...]
}
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
# [...]
}
Configuración de apache:
Creamos el formato "varnishcombined" el cual es el que se registrará en nuestro log:
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined
En el virtualhost del apache se requiere especificar el formato en lugar de "common" o "combined":
<virtualhost *:80="">
ServerName www.example.com
# [...]
CustomLog /var/log/apache2/www.example.com/access.log varnishcombined
# [...]
</virtualhost>
ServerName www.example.com
# [...]
CustomLog /var/log/apache2/www.example.com/access.log varnishcombined
# [...]
</virtualhost>
Comentarios
Publicar un comentario
Escribe tu comentario acerca de las dudas que tengas y yo te atenderé con gusto =)
GRACIAS