apache 中 cloudflare 的日志格式
LogFormat for cloudflare in apache
我在 Apache.conf 中设置了 LogFormat。但是我无法在 access.log.Can 中看到来自 cloudflare 的任何日志,你建议我,这对我们来说很棒。
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
用于测试:
[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
我注意到您所有的 LogFormat 行都有相同的昵称。这可能会导致名称冲突。在这一行之后是否有 CustomLog 行指定写入日志的格式?通常我看到这种风格的配置:
LogFormat "%v %{CF_CONNECTING_IP}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare
CustomLog /var/log/httpd/access_log cloudflare
尽管包括您自己的访问日志路径。 http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog
我在 Apache.conf 中设置了 LogFormat。但是我无法在 access.log.Can 中看到来自 cloudflare 的任何日志,你建议我,这对我们来说很棒。
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
用于测试:
[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
我注意到您所有的 LogFormat 行都有相同的昵称。这可能会导致名称冲突。在这一行之后是否有 CustomLog 行指定写入日志的格式?通常我看到这种风格的配置:
LogFormat "%v %{CF_CONNECTING_IP}i (via cloudflare:%h) %l %u %t \"%r\" %>s %b" cloudflare
CustomLog /var/log/httpd/access_log cloudflare
尽管包括您自己的访问日志路径。 http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog