Skip to content

Cloudflare (Logpush)

Cloudflare Logpush sends Log Hero a record of every request that Cloudflare answers for your domain. This includes the requests that Cloudflare serves from cache, which never get to your origin server. You do not install code on your server. You create one API token in Cloudflare, and Log Hero creates the Logpush job for you.

Time: about 10 minutes · Access needed: Cloudflare account with access to the domain, Log Hero account

Make sure that you have:

  • A Cloudflare account that can create an API token for the domain.
  • The domain added in Log Hero. If it is not, do the Quickstart first.
  • Fewer than four Logpush jobs on the domain. Cloudflare permits four jobs per domain, and Log Hero adds one.

Cloudflare bills Logpush volume separately from your Log Hero plan.

Log Hero uses this token once, to create the Logpush job. Log Hero does not store the token.

  1. Open dash.cloudflare.com/profile/api-tokens.

  2. Choose Create Token and start a custom token.

  3. Under Permissions, choose Add more and add these two permissions:

    Scope Category Permission
    Zone Zone Read
    Zone Logs Edit
  4. Under Zone Resources, select the domain that you want to connect.

  5. Choose Continue to summary, then Create Token.

  6. Copy the token. Cloudflare shows it only once.

The token does not need Analytics → Read. Do not add more permissions than the two in the table.

  1. In your Keyword Hero account, open Log Hero → Bot Activity for the domain.
  2. Choose Log Hero token. The setup page opens.
  3. Under How to start?, choose Cloudflare.
  4. Paste the token into the Cloudflare API token field.
  5. Choose Connect.
  6. If the token gives access to more than one domain, select the domain from the list.
  7. Choose Confirm.

Log Hero shows Connected — your data will start showing up in Log Hero within about an hour. At this point Log Hero has created a Logpush job named loghero on your domain in Cloudflare.

  1. In the Cloudflare dashboard, go to Analytics & Logs → Logpush.
  2. Make sure that the job loghero is listed and that its status is not Error.
  3. Wait up to one hour. Logpush collects records in batches before it sends them.
  4. Open Log Hero → Bot Activity. Make sure that the status line reads Log Hero is receiving bot traffic for this domain.
  5. Make sure that Bot hits is not zero.

When Cloudflare creates the job, it sends Log Hero a small test message. This message contains no request data and does not appear as a hit.

You do not need to make traffic yourself. Bots arrive on their own, and on most sites the first bot request lands within the hour.

Message Cause What to do
We couldn’t validate this token. The token is wrong or expired, or Cloudflare did not answer. Paste the token again. If the error stays, create a new token.
This token is missing a required permission. The token lacks Zone → Read or Logs → Edit. Create a new token with the two permissions from step 1.
This domain already has the maximum number of Logpush jobs Cloudflare allows. The domain has four Logpush jobs. Remove one job in the Cloudflare dashboard. Then choose Confirm again.
This domain is already sending logs to Log Hero. A loghero job exists on the domain. Do nothing. The domain is connected.
Something went wrong connecting to Cloudflare. A temporary error. Try again.

Log Hero creates the job on the Cloudflare http_requests dataset with a fixed list of ten fields. You cannot change this list in Log Hero. If you add fields to the job in Cloudflare, Log Hero ignores them.

ClientIP
ClientRequestHost
ClientRequestMethod
ClientRequestReferer
ClientRequestScheme
ClientRequestURI
ClientRequestUserAgent
EdgeResponseStatus
EdgeStartTimestamp
EdgeTimeToFirstByteMs

Three facts about these fields matter for your reports:

  • ClientIP is required. When the record arrives, Log Hero hashes the address and does not store the raw address. The hash identifies the visitor. A record without ClientIP is dropped.
  • Timing is measured at the edge. EdgeTimeToFirstByteMs is the time from Cloudflare’s edge to the first byte of the response. The origin integrations measure the time inside your server, so the two values are not comparable.
  • Sampling is off. Log Hero does not turn on sampling when it creates the job, and the bot counts depend on that. Do not turn on sampling for the job in Cloudflare.
  • Requests that Cloudflare never sees. Traffic that goes to your origin directly is invisible here. If your DNS has a bare origin hostname, bots will find it.
  • Requests that Cloudflare stops before it logs them. A WAF rule, a rate limit, or Bot Fight Mode stops the request before Logpush records it. If your Bot Activity report shows far fewer AI crawlers than you expect, examine those rules first.

Log Hero cannot delete the job for you.

  1. In the Cloudflare dashboard, go to Analytics & Logs → Logpush.
  2. Delete the job named loghero.

Data stops within the hour. If you connect the domain again later, Log Hero creates a new job.

Work through No data arriving. Two causes are specific to Cloudflare. The first is a Logpush job in the Error state, which Cloudflare shows in the job list. The second is a WAF rule that stops the crawler before Cloudflare logs it.