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;

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.