---
title: "corestack_varnish_stats"
url: https://docs.corefinity.com/mcp/tools/corestack_varnish_stats
type: tool
last_updated: 2026-11-13
feature: varnish
related:
  - https://docs.corefinity.com/api/reference/varnish/get-site-varnish-stats.md
  - https://docs.corefinity.com/guides/sites/software-and-services/varnish.md
---
# corestack_varnish_stats

**Varnish cache statistics.** A Magento 2 row's Varnish figures over the last hour, 24 hours or 7 days: hit ratio, requests, hits, misses and passes, cached objects, page storage used, evictions, backend fetches and errors, per bucket and in total, with the recent purges and the hourly purge allowance. Scope: read.

- Scope: `read`
- Runs as a task: no

## When to use it

A Magento 2 row's Varnish figures over the last hour, 24 hours or 7 days: hit ratio, requests, hits, misses and passes,
cached objects, page storage used, evictions, backend fetches and errors, per bucket and in total, with the recent
purges and the hourly purge allowance. The figures come from a sample of the row's Varnish counters every 5 minutes, so
the newest bucket is still filling. Use `corestack_varnish_get` for the status, version and cache size.

## Inputs

- `site_id` (integer, ≥ 1, required): the row, a Magento 2 site or one of its environments.
- `range` (one of `1h`, `24h`, `7d`): `1h` gives 12 buckets of 5 minutes, `24h` (the default) 24 hourly buckets, `7d`
  28 buckets of 6 hours.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "range": {
      "description": "1h (5-minute buckets), 24h (hourly, the default) or 7d (6-hourly).",
      "enum": [
        "1h",
        "24h",
        "7d"
      ],
      "type": "string"
    },
    "site_id": {
      "description": "The row: a Magento 2 site or one of its environments.",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id"
  ],
  "type": "object"
}
```

## Refusals

- `varnish_not_offered`: the row is not a Magento 2 site.
- `varnish_off`: Varnish is switched off on this row; Magento's built-in cache is serving pages.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`,
  `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_varnish_stats",
  "arguments": {
    "site_id": 4211,
    "range": "24h"
  }
}
```

## Answer

- `available`: false with `reason: "sampler_pending"` until the row's first two samples exist (about 10 minutes after
  Varnish is first switched on, or after its next platform update); the buckets are then empty.
- `buckets[]`: `at` (the bucket's start, UTC), `hits`, `misses`, `passes`, `requests`, `backend_fetches`,
  `backend_errors`, `evictions` (counts in the bucket), `hit_ratio` (hits ÷ (hits + misses), 0–1; passes such as admin,
  checkout, customer and signed-in API calls are never cached and are left out), `requests_per_s`, `objects`,
  `bytes_used` and `storage_bytes` (page storage used and its size), `transient_bytes`, `reset` (Varnish began counting
  again in the bucket). A value Varnish did not report for a bucket is `null`, never 0.
- `totals`: the same counts over the range, `hit_ratio`, `pass_ratio`, `requests_per_s`, `peak_requests_per_s`,
  `hit_ratio_7d`, the newest `objects`, `bytes_used` and `storage_bytes`, `resets` (times Varnish began counting again), and `missing` (counters this
  Varnish does not report).
- `recent_purges[]` (newest first, up to 10 in 7 days): `at`, `source` (`person`, `deployment` or `automatic`), `via`
  (`panel`, `api` or `mcp`), `by.name`, `mode`, `items`, `hosts` (empty = every host), `status` and `confirmed`. Varnish
  confirms a purge; it does not count pages.
- `purges_this_hour`: `used`, `limit` and, when none is left, `available_at`. Magento's own purges and deployments are not
  counted.
- `hosts`: the site's own hosts, the only ones a purge by address or pattern may name.
- `sampled_at` (the newest sample) and `stale` (no sample for more than 15 minutes).

## Prompt

```text
Using the Corefinity MCP server, call corestack_varnish_stats with site_id 4211, range 24h. (Varnish cache statistics.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [GET /api/corestack/sites/{site}/varnish/stats](https://docs.corefinity.com/api/reference/varnish/get-site-varnish-stats.md)
- Guide: [Varnish](https://docs.corefinity.com/guides/sites/software-and-services/varnish.md)
