PulseAugur
EN
LIVE 02:25:58

Developer creates script to manage Claude Code log file bloat

A developer has created a custom script to manage log file sizes for Claude Code, an AI coding assistant. The script, named `log-rotate.sh`, runs nightly via `launchd` and prevents log files within the `~/.claude/logs/` directory from growing excessively. It achieves this by keeping only the last 2000 lines of files exceeding 5MB, using a `tail` command and overwriting the original file with `mv` to preserve the file's inode and path. This method is preferred over `logrotate`'s `copytruncate` option to avoid losing log data during heavy write periods. AI

IMPACT Provides a practical solution for managing AI tool log file sizes, preventing disk space issues for users.

RANK_REASON The item describes a custom script developed by a user to manage the log files of an AI product, which falls under the category of a user-developed tool or utility.

Read on dev.to — Claude Code tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

Developer creates script to manage Claude Code log file bloat

COVERAGE [1]

  1. dev.to — Claude Code tag TIER_1 English(EN) · Lily ·

    Nightly tail-truncation: how I stopped Claude Code's logs from quietly eating my disk

    <p>Log files never announce themselves. They just sit there growing until something breaks. This is part of my "Claude Code environment" series — the previous post, "<a href="https://zenn.dev/bokuwalily/articles/agent-log-trim" rel="noopener noreferrer">Trimming agent logs</a>", …