Adding the CF-RAY header to your logs

The CF-RAY header is added to help with tracing a request to a website through CloudFlare's network. You can use the ID when working with CloudFlare Support to help troubleshoot any related issues you may have with connectivity. At the same time, you can reveal this "Ray ID" in your logs by making some edits to configuration files in Apache and nginx.


For Apache:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" (%{CF-Ray}i)" cf_custom
CustomLog log/access_log cf_custom

For nginx:

log_format cf_custom '$remote_addr - $remote_user [$time_local]  '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent"'

access_log  /var/log/nginx/access.log cf_custom;
Still not finding what you need?

The CloudFlare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.