Workers SDK Issue Reports

← Back to Dashboard

#10523 wrangler uses unbounded disk space for logs, no flag to disable

Recommendation:KEEP OPEN
Difficulty:easy
Reasoning:

Confirmed bug: ALL logs written to disk unconditionally with no auto-deletion. Maintainer acknowledged 20GB accumulation. No fix merged.

Suggested Action:

Keep open - implement WRANGLER_LOG_DISK env var and auto-deletion of old logs

Analysis Report

Issue Review: cloudflare/workers-sdk#10523

Summary

Wrangler writes all logs to disk unconditionally with no auto-deletion, causing unbounded disk usage (20GB+ reported).

Findings

  • Created: 2025-09-02
  • Updated: 2025-09-11
  • Version: "latest" (no specific version) -> 4.60.0
  • Component: wrangler (logging)
  • Labels: bug, quick win
  • Comments: 4 (includes maintainer acknowledgment)

Key Evidence

  • Issue confirmed by maintainer: @dario-piotrowicz (Cloudflare team member) confirmed having ~20GB of logs and agreed auto-deletion should be implemented.
  • Root cause verified: Code inspection confirms appendToDebugLogFile() is called unconditionally for ALL logs in logger.ts, with no disable flag.
  • No existing fix: No merged PRs or changelog entries reference this issue or add log retention/disable features.
  • WRANGLER_LOG behavior: Only controls console output level, not disk logging. WRANGLER_LOG_PATH only changes the directory, doesn't disable logging.
  • Users affected: Multiple users reporting disk space issues; one team (darcyclarke) migrated away from wrangler partly due to this.

Technical Details

From packages/wrangler/src/logger.ts:

// unless in unit-tests, send ALL logs to the debug log file (even non-debug logs for context & order)
const inUnitTests = typeof vitest !== "undefined";
if (!inUnitTests) {
    void appendToDebugLogFile(messageLevel, message);
}

Logs are stored in ~/.wrangler/logs/wrangler-<timestamp>.log with no rotation or cleanup.

Recommendation

Status: KEEP OPEN

Reasoning: This is a legitimate bug acknowledged by a Cloudflare maintainer. The issue causes real problems for users (20GB+ disk usage, unnecessary I/O). No fix has been implemented. The "quick win" label suggests it's prioritized for resolution.

Action: Keep open. Implementation suggestions:

  1. Add WRANGLER_LOG_DISK=false env var to disable disk logging
  2. Implement auto-deletion of logs older than 30 days
  3. Consider log rotation (keep only last N sessions or X MB)

Notes & Feedback (0)

No notes yet.

Add Note