HTTP analytics

What is the name of the domain?

example.com

What is the issue you’re encountering

How to get access to HTTP analytics

What steps have you taken to resolve the issue?

I want to get programmatic access to HTTP analytics - i.e. as shown on the Cloudflare dashboard when you go to a site and choose “Analytics & Logs” → “HTTP Traffic”. In particular, I want to get a list of all URLs (although preferably filtered by a rule) fetched during a time period, and how many times each was fetched (so each unique URL is listed once accompanied by a counter). This is basically exactly the same information that is shown on the HTTP Traffic dashboard page, so Cloudflare must have it, but I can’t find any information about how to fetch it via the API (plus of course I want more than just the top 15). I do not want to use “Web Analytics”, it has to be based on the HTTP logs, not least because the fetches I want to count do not return HTML pages.

What feature, service or problem is this related to?

Other / I don’t know

Use GraphQL…

1 Like

Could you give me a hint as to where to look please? I tried the following, which gives me a total number of requests, but I need requests-per-url:

{
  viewer {
    zones(filter: { zoneTag: $zoneTag }) {
      httpRequests1dGroups(
        filter: {
          date: $date
        }
        limit: 10
      ) {
          sum { requests }
      }
    }
  }
}

Thanks for the pointer. The following seems to be more or less working, I think:

query ($zoneTag: string!, $start: Time!, $end: Time!) {
  viewer {
    zones(filter: { zoneTag: $zoneTag }) {
      httpRequestsAdaptiveGroups(
        filter: {
          clientRequestHTTPHost: "example.com"
          clientRequestPath_neq: "/"
          datetime_geq: $start
          datetime_lt: $end
          originResponseStatus_lt: 300
        }
        limit: 10000
        orderBy: [count_DESC]
      ) {
          count
          dimensions { metric: clientRequestPath }
      }
    }
  }
}