gustavhartz/agentskills/cf-worker-logs
Claude Code and agent skill by gustavhartz/agentskills
- community
Checking that the SKILL.md file is still in the repository.
Read Cloudflare Worker logs — historical (past hours/days) via the Workers Observability query API, or live via wrangler tail. Use when asked to check logs, debug a deployed Worker, find what happened earlier (a past request, signup, error), or watch cron/request activity in production or staging. Portable across any repo with a wrangler config.
Install
npx vskill@latest install gustavhartz/agentskills/cf-worker-logsSKILL.md
The same SKILL.md was published earlier as gustavhartz/agentskills/cf-worker-logs.
CF Worker Logs
Three modes, one helper. Node 20.6+ runs the .mts directly (no build, no install).
| Mode | What | Auth | |
|---|---|---|---|
logs (default) | Historical logs from the Workers Observability telemetry/query API — query the past N hours/days | API token | |
metrics | Request/error/CPU rollups via the GraphQL Analytics API | API token | |
tail | Live stream via wrangler tail (from now on) | wrangler OAuth login |
Historical-query logic is ported from kevinsimper/cf-worker-logs (the observability/telemetry/query request shape + event normalization), minus its zod dependency, and with account id + worker name auto-derived from the wrangler config.
Running it
cf-worker-logs.mts sits next to this file. Set H to that path — it depends on where the skill was installed (.claude/skills/, .agents/skills/, ~/.claude/skills/, …):
Auth (logs / metrics need an API token)
wrangler tail's OAuth login is not accepted by the Observability REST endpoint (it returns 9106 Authentication failed), so historical logs/metrics need a Cloudflare API token:
- Create at **dash.cloudflare.com → My Profile → API Tokens → Create Token →
Custom, with Account › Workers Observability › Read (add Account › Account Analytics › Read** for metrics).
- Provide it via
CF_OBS_TOKEN(preferred — a name wrangler ignores, so it
can't override wrangler's OAuth login the way CLOUDFLARE_API_TOKEN does), or CF_TOKEN / CLOUDFLARE_API_TOKEN, or --token.
tail needs no token — it uses your existing wrangler CLI login.
Target resolution (no need to pass account/worker)
- Config:
--config <path>, else auto-discoverwrangler.{toml,jsonc,json}
in the cwd then up to 2 levels down (monorepos). Several found → it lists them and asks for --config.
- Account id:
--account, elseaccount_idfrom the config, else
CLOUDFLARE_ACCOUNT_ID.
- Worker name:
--worker, else<name>from the config; with--env <e>
the script name becomes <name>-<e> (wrangler's convention, e.g. a worker named my-api with --env production → my-api-production). Override with --worker if your env block renames it.
Time window & filters (logs / metrics)
--since 15m|1h|24h|7d(default1h), or absolute--from <ISO> --to <ISO>.--severity debug|log|info|warn|error— at or above this level.--level <one>— exactly this level.--contains <text>— message substring.--where '$workers.event.request.path = "/api/x" AND $metadata.service = "y"'—
server-side equality filters on $metadata.* / $workers.* fields (AND only).
--limit <n>(default 100, server max 1000).--json/--rawoutput.
History vs live — which to use
- Something already happened (a past signup, an error an hour ago, a cron run
this morning) → logs --since …. This reads stored events; the Worker must have [observability] enabled = true (it logs at head_sampling_rate).
- Watch it happen now (trigger a request and see it) →
tail. Live-only: a
quiet Worker shows nothing, and it can't look backwards. Run it in the background, give it ~8s to connect, then hit the Worker.
Notes
tailpasses unknown flags straight towrangler tail(--status error,
--method POST, --search, --ip self). Do not pass --format — the helper sets --format pretty itself (a duplicate makes wrangler error out).
- A bare number in
tailmode is an auto-stop window in seconds (tail … 25).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cf-worker-logs/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/gustavhartz/agentskills/cf-worker-logs)