0

I have configured apache2 behind varnish and am trying to add stats by log reading (piwik)

however piwik complains log is "malformed"... and its correct :

89.79.******, 89.79.****** - - [31/Mar/2014:12:50:05 +0200] "GET / HTTP/1.1" 200 16310 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"

as you can see it logs the same ip twice as host...

in varnish .vcl i have :

  remove req.http.X-Forwarded-For;
  set req.http.X-Forwarded-For = client.ip;

and in apache2 vhost :

        LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined
        CustomLog ${APACHE_LOG_DIR}/e***o-access.log varnishcombined

however it still logs the ip twice ...

what can i do to prevent that ?

n00b
  • 5,642
  • 2
  • 30
  • 48

1 Answers1

0

I ended up using mod_cloudflare : https://support.cloudflare.com/hc/en-us/articles/200170796-How-do-I-install-mod-cloudflare-on-Apache-

and setting the trusted proxy to 127.0.0.1 + log combined

if anyone has a better solution....

n00b
  • 5,642
  • 2
  • 30
  • 48