0

I have setup LogFormat in Apache.conf. But i am not able to see any logs from cloudflare in access.log.Can you suggest me, it would be great for us.

LogFormat "%v %{CF-IPCountry}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare

LogFormat "%v %{CF-Ray}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare

LogFormat "%v %{CF_CONNECTING_IP}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare

LogFormat "%v %{CF_VISITOR}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare

For testing :

[iravindra@iravindrahost ~]# tail -f /var/log/httpd/access_log| grep "abc"


108.162.222.163 - - [10/Apr/2015:01:25:13 -0400] "GET /abc.png HTTP/1.1" 404 287 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Andrey Korneyev
  • 26,353
  • 15
  • 70
  • 71

1 Answers1

0

I noticed that all your LogFormat lines have the same nickname. This might be causing a name collision. Do you have a CustomLog line following this one that specifies which format to write the logs in? Usually I see the config in this kind of style:

LogFormat "%v %{CF_CONNECTING_IP}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare
CustomLog /var/log/httpd/access_log cloudflare

Include your own access log path though. http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog

5kKate
  • 61
  • 5
  • Hi @5kKate Thanks for this, it is working. But it is showing some wrong. **127.0.0.1 - (via cloudflare:173.245.62.229) ** - - [13/Apr/2015:03:15:50 -0400] "GET /abc.png HTTP/1.1" 404 287 . it is showing 127.0.0.1 IP and cloudflare IP. But i want to replace 127.0.0.1 with cloudflare IP and cloudflare Ip with Client IP. Please suggest me. – Ravindra Moyal Apr 13 '15 at 07:26
  • Are you using mod_cloudflare? https://support.cloudflare.com/hc/en-us/articles/200170786 – 5kKate Apr 13 '15 at 19:05
  • Now i have installed mod_cloudflare, after that all thing is working fine. Thanks mate @5kKate. – Ravindra Moyal Apr 14 '15 at 08:25