Skip to content

Connect Cloudflare Logpush

Updated 29 November 2026

Have Cloudflare push request logs for your domain to Brandexa, either with a one-time token or with commands you run yourself.

What to know

Cloudflare Logpush sends your zone's HTTP request logs to Brandexa as compressed files. It needs a Cloudflare plan that includes Logpush for HTTP requests. If yours does not, use the Cloudflare Worker method.

Before you start

  • Your domain is active on Cloudflare.
  • You have a Cloudflare API token with Zone Read and Logs Write on that zone.

Guided setup

  1. In Brandexa, open Agent analytics, then Logs, and choose Connect request logs.
  2. Choose Cloudflare Logpush, then paste your token.
  3. Choose the domain. Brandexa shows what it will create and asks you to confirm.
  4. Choose Connect. Brandexa creates the Logpush job on your zone and does not keep the token.
  5. Choose Check status.

The token is used once and is not stored. Create it in Cloudflare under My Profile, API Tokens, and delete it when the connection works.

Run the commands yourself

The Request logs screen in Brandexa shows these commands with your domain and your own source key already filled in. The versions below use example.com and a placeholder so you can read them first.

These steps need curl and jq. They remove an earlier Brandexa job first, so you can run them again safely.

Set your Cloudflare API token
export CF_TOKEN="<your Cloudflare API token>"
BASE="https://api.cloudflare.com/client/v4"
Find the zone for example.com
ZONE_ID=$(curl -s --fail-with-body "$BASE/zones?name=example.com&status=active&match=all" \
  -H "Authorization: Bearer $CF_TOKEN" | jq -r '.result[0].id // error("no active Cloudflare zone found for example.com")')
echo "ZONE_ID=$ZONE_ID"
Remove an existing Brandexa job, if there is one
OLD_JOB_ID=$(curl -s --fail-with-body "$BASE/zones/$ZONE_ID/logpush/jobs" \
  -H "Authorization: Bearer $CF_TOKEN" \
  | jq -r '([(.result // [])[] | select(.name == "brandexa-agent-analytics-http-requests")])[0].id // ""')
if [ -n "$OLD_JOB_ID" ]; then
  curl -s --fail-with-body -X DELETE "$BASE/zones/$ZONE_ID/logpush/jobs/$OLD_JOB_ID" \
    -H "Authorization: Bearer $CF_TOKEN"
fi
Create the Logpush job
curl -s --fail-with-body -X POST "$BASE/zones/$ZONE_ID/logpush/jobs" \
  -H "Authorization: Bearer $CF_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "name": "brandexa-agent-analytics-http-requests",
  "dataset": "http_requests",
  "enabled": true,
  "destination_conf": "https://ingest.brandexa.com/v1/logs/cloudflare?header_x-brandexa-source=<YOUR_SOURCE_KEY>",
  "max_upload_bytes": 5000000,
  "max_upload_records": 20000,
  "filter": "{\"where\":{\"or\":[{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"example.com\"},{\"key\":\"ClientRequestHost\",\"operator\":\"endsWith\",\"value\":\".example.com\"}]}}",
  "output_options": {
    "field_names": [
      "EdgeStartTimestamp",
      "ClientRequestHost",
      "ClientRequestMethod",
      "ClientRequestPath",
      "ClientRequestUserAgent",
      "EdgeResponseStatus",
      "EdgeResponseBytes",
      "ClientCountry",
      "RayID"
    ],
    "timestamp_format": "rfc3339"
  }
}
JSON

What the job sends

The job asks Cloudflare for nine fields: start time, host, method, path, user agent, status, bytes, country and ray ID. It does not ask for the visitor's address. It is filtered to your domain and its subdomains.

Brandexa keeps only requests from recognised AI crawlers and search engines. For each one it stores the time, host, path without the query string, method, status, size, country and crawler name. It does not store visitor addresses, query strings, cookies or the user agent text.

Check that it works

  • The source shows Receiving once records arrive. Cloudflare delivers in batches, so allow a few minutes.
  • Records appear on the Logs screen under the recent requests table.

If something goes wrong

  • The token is refused. It needs Zone Read and Logs Write on this zone, and it must be active.
  • Nothing arrives. Open the job in Cloudflare under Analytics and logs, Logpush and read its last error.
  • To disconnect, remove the source in Brandexa. Brandexa deletes the job if you give it a token again, or you can delete it in Cloudflare.

Still need help?

If you have a question or something is not working, get in touch.

Contact us