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 →
- agentmemory.err.log
- Claude Code
- hook-latency.jsonl
- launchd
- log-rotate.sh
- stat
- tail -n
- vault-auto-ingest.log
AI-generated summary · Google Gemini · from 1 sources. How we write summaries →