---
name: cloudflare-weekly-traffic-and-threats
description: "Every Monday: requests, cache hit ratio, bandwidth and threats per Cloudflare zone for last week, against the week before, with top countries. Use when the user asks for this, or when it runs on a schedule."
---

# Cloudflare weekly traffic and threats report

Every Monday: requests, cache hit ratio, bandwidth and threats per Cloudflare zone for last week, against the week before, with top countries.

The Cloudflare dashboard has good charts per zone, and most people with five zones look at one of them now and then. A falling cache hit ratio after a deploy, or a week where one country sends ten times its usual traffic, goes unnoticed until the origin bill or an outage points at it.

The agent reads the GraphQL Analytics API for every zone on the account and lays last week next to the week before: requests, share served from cache, bandwidth, threats, and the countries traffic came from. It points at the zone that changed and the likely reason.

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- A Cloudflare API token with Zone Analytics read access for the zones (and Account Analytics read) in `CLOUDFLARE_API_TOKEN`.
- Or the Cloudflare API MCP server at `https://mcp.cloudflare.com/mcp`.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **List the zones** (Cloudflare): `GET https://api.cloudflare.com/client/v4/zones?status=active` returns each zone's `id` and `name`. Use the list in the prompt to skip parked domains.
2. **Query daily traffic for two weeks** (Cloudflare): GraphQL `viewer { zones(filter: {zoneTag: $zone}) { httpRequests1dGroups(limit: 14, filter: {date_geq: $start, date_leq: $end}, orderBy: [date_ASC]) { dimensions { date } sum { requests cachedRequests bytes cachedBytes threats countryMap { clientCountryName requests threats } } uniq { uniques } } } }`, then split into last week and the week before.
3. **Compute the ratios**: Cache hit ratio = `cachedRequests / requests`, bandwidth saved = `cachedBytes / bytes`. Sum `countryMap` by country for the top five, and flag a country whose requests grew more than threefold.
4. **Break down security actions** (Cloudflare): Where your plan keeps security events for the week, query `firewallEventsAdaptiveGroups(limit: 10, filter: {datetime_geq, datetime_leq}, orderBy: [count_DESC]) { count dimensions { action source } }` to show what was blocked or challenged, and by which rule type.
5. **Report**: Account totals with the weekly change, then one row per zone, then the top countries and security actions. Call out a cache hit ratio that dropped more than 5 points.

## Route B: the browser

### What you need

- Signed in to the Cloudflare dashboard with a member role that can read analytics for the zones, such as Analytics or Administrator Read Only.

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://dash.cloudflare.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **Start with the account view**: The dashboard opens on the account list; pick the account. In the account sidebar open **Analytics & Logs** > **Account analytics**, set the time range to **Previous 7 days**, and read total requests, bandwidth and the per-zone breakdown. Repeat with the custom range for the week before.
2. **Open each zone's traffic analytics**: Go back to the account home, click the zone, then **Analytics & Logs** > **Traffic**. With **Previous 7 days** set, read **Requests**, **Bandwidth** (served versus cached) and **Unique visitors**; cache hit ratio is cached requests divided by requests.
3. **Read the countries**: Further down the Traffic page, the **Top countries** list and map give requests by country for the range. Note the top five and compare with the previous week's range for any country that grew more than threefold.
4. **Read the security actions**: In the zone sidebar open **Security** > **Analytics** (or **Security** > **Events** on zones that still show the older layout), same range. Read mitigated requests, then the breakdown by **Action** (block, managed challenge, JS challenge) and by **Service** or source (WAF, rate limiting, bot management).
5. **Report**: Account totals with the weekly change, one row per zone, the top countries and the security actions. Call out any zone whose cache hit ratio dropped more than 5 points.

Note: The dashboard ranges are rolling (previous 7 days from now), not Monday to Sunday, so numbers differ slightly from the API report; custom ranges fix that on plans that allow them. How far back Security analytics goes depends on the plan, and on Free zones it can be shorter than a week. Account analytics may be sampled on very busy accounts.

## The report

- **Totals**: requests, unique visitors, bandwidth, cache hit ratio and threats, with the weekly change.
- **Per zone**: the same, one row each.
- **Top countries** by requests, with any sudden riser flagged.
- **Security actions**: blocked and challenged requests by source, where available.
- One line on what to look at, such as a cache rule that stopped matching.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "cloudflare-weekly-traffic-and-threats/<date of this run, e.g. 2026-10-16>",
  "item_key": "cloudflare-weekly-traffic-and-threats",
  "project": "Acme",
  "source": "Cloudflare weekly traffic and threats report skill",
  "kind": "update",
  "title": "Traffic up 6%, cache hit ratio down on shop.example.com",
  "summary": "**12.4M** requests across 3 zones last week, up 6%. **shop.example.com** fell from 78% to **64%** served from cache after Thursday's deploy.",
  "widget": [
    {
      "type": "Grid",
      "props": {
        "columns": 3
      },
      "children": [
        {
          "type": "Stat",
          "props": {
            "label": "Requests",
            "value": "12.4M",
            "delta": 6
          }
        },
        {
          "type": "Stat",
          "props": {
            "label": "Cache hit ratio",
            "value": 71,
            "unit": "%"
          }
        },
        {
          "type": "Stat",
          "props": {
            "label": "Threats",
            "value": 48210,
            "delta": 22,
            "better": "lower"
          }
        }
      ]
    },
    {
      "type": "Table",
      "props": {
        "columns": [
          "Zone",
          "Requests",
          "Cached",
          "Bandwidth",
          "Threats"
        ],
        "align": [
          "left",
          "right",
          "right",
          "right",
          "right"
        ],
        "rows": [
          [
            "example.com",
            "7.1M",
            "76%",
            "412 GB",
            "31,040"
          ],
          [
            "shop.example.com",
            "4.2M",
            "64%",
            "286 GB",
            "15,900"
          ],
          [
            "docs.example.com",
            "1.1M",
            "68%",
            "38 GB",
            "1,270"
          ]
        ]
      }
    },
    {
      "type": "Bars",
      "props": {
        "unit": "requests",
        "items": [
          {
            "label": "United States",
            "value": 5210000
          },
          {
            "label": "Germany",
            "value": 1640000
          },
          {
            "label": "United Kingdom",
            "value": 1120000
          },
          {
            "label": "Singapore",
            "value": 980000
          },
          {
            "label": "Canada",
            "value": 610000
          }
        ]
      }
    },
    {
      "type": "Callout",
      "props": {
        "text": "Singapore traffic tripled on shop.example.com, mostly to /api/products. Check whether it is a scraper before raising cache TTLs.",
        "tone": "warn"
      }
    }
  ]
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

## Run it on a schedule

Suggested: Mondays at 8:00 (`0 8 * * 1`). From cron, with the agent signed in on that machine:

```bash
0 8 * * 1 claude -p "Run the cloudflare-weekly-traffic-and-threats skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/cloudflare-weekly-traffic-and-threats#schedule

Source: https://briefkin.dev/skills/cloudflare-weekly-traffic-and-threats
