Docs
Search docs...⌘K

Cloudflare Logpush

Cloudflare Logpush sends HTTP request logs to Ahrefs automatically. It is the recommended method for high-traffic sites, but requires a Cloudflare Enterprise plan.

Prerequisites

Automatic setup

  1. In Ahrefs, go to Project Settings → Bot Analytics.
  2. Select Cloudflare Logpush as the method.
  3. Paste your Cloudflare API token and click Connect.

Ahrefs will use your token to:

  1. Find the zone matching your project's domain.
  2. Check for existing Logpush jobs.
  3. Create a new job that sends logs to Ahrefs.

info

Your token is used once and not stored.

Manual setup

If you prefer not to provide an API token, you can set up the Logpush job manually using the Cloudflare API.

Step 1 — Get your Zone ID and API token

  1. Go to your Cloudflare dashboard and select your website's domain.
  2. In the right sidebar, scroll down to the API section to find your Zone ID.
  3. Click "Get your API token" and create a new token with the following permission:
    • Zone → Logs → Edit

Step 2 — Create the Logpush job

Once you have your $ZONE_ID and $CF_TOKEN, run the following command. You can find the exact command pre-filled with your project's details in Project Settings → Bot Analytics → Set up manually.

curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/logpush/jobs" \
  -X POST \
  -H "Authorization: Bearer $CF_TOKEN" \
  --data-binary '{
  "name": "ahrefs-web-analytics-http-requests",
  "destination_conf": "https://analytics.ahrefs.com/api/cf_logpush/http_requests?header_x-ahrefs-web-analytics-property=YOUR_PROPERTY_KEY",
  "dataset": "http_requests",
  "frequency": "high",
  "filter": "{\"where\":{\"or\":[{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"yourwebsite.com\"},{\"key\":\"ClientRequestHost\",\"operator\":\"endsWith\",\"value\":\".yourwebsite.com\"}]}}",
  "output_options": {
    "field_names": [
      "ClientIP", "ClientRequestMethod", "ClientRequestHost",
      "ClientRequestProtocol", "ClientRequestScheme", "ClientRequestURI",
      "ClientRequestPath", "ClientRequestUserAgent", "ClientRequestReferer",
      "EdgeStartTimestamp", "EdgeEndTimestamp", "EdgeResponseStatus",
      "EdgeResponseBytes", "EdgeResponseContentType",
      "EdgeTimeToFirstByteMs", "ClientCountry", "ClientCity", "ClientASN",
      "ClientDeviceType", "ClientRegionCode", "BotScore", "BotScoreSrc",
      "BotTags", "VerifiedBotCategory", "RayID"
    ],
    "timestamp_format": "unixnano"
  },
  "enabled": true
}'

warning

The destination_conf URL and property key are unique to your project. Copy the exact command from your Project Settings → Bot Analytics page to ensure the correct values.

Step 3 — Verify the connection

After creating the job, go back to Project Settings → Bot Analytics in Ahrefs and click Check status to verify that data is being received.