LogRotate
by BytesAgain
Rotate, compress, and clean old log files to keep directories tidy automatically. Use when rotating logs, compressing old files, freeing disk space.
安装
claude skill add --url github.com/openclaw/skills/tree/main/skills/ckchzh/logrotate文档
LogRotate
A sysops toolkit for scanning, monitoring, reporting, alerting, and managing system operations. Each command logs timestamped entries to local files with full export, search, and statistics support.
Commands
Core SysOps Operations
| Command | Description |
|---|---|
logrotate scan <input> | Record a scan result (or view recent scans with no args) |
logrotate monitor <input> | Log a monitoring observation or metric |
logrotate report <input> | Record a report entry or summary |
logrotate alert <input> | Log an alert event or threshold breach |
logrotate top <input> | Record top resource consumers or rankings |
logrotate usage <input> | Log resource usage data (disk, CPU, memory, etc.) |
logrotate check <input> | Record a health check or validation result |
logrotate fix <input> | Log a fix or remediation action taken |
logrotate cleanup <input> | Record a cleanup operation (old files, temp dirs, etc.) |
logrotate backup <input> | Log a backup task and its outcome |
logrotate restore <input> | Record a restore operation |
logrotate log <input> | Log a generic operational entry |
logrotate benchmark <input> | Record a performance benchmark result |
logrotate compare <input> | Log a comparison between configurations or time periods |
Utility Commands
| Command | Description |
|---|---|
logrotate stats | Show summary statistics across all log files |
logrotate export <fmt> | Export all data in json, csv, or txt format |
logrotate search <term> | Search all entries for a keyword (case-insensitive) |
logrotate recent | Show the 20 most recent activity log entries |
logrotate status | Health check: version, entry count, disk usage, last activity |
logrotate help | Display full command reference |
logrotate version | Print current version (v2.0.0) |
How It Works
Every core command accepts free-text input. When called with arguments, LogRotate:
- Timestamps the entry (
YYYY-MM-DD HH:MM) - Appends it to the command-specific log file (e.g.
scan.log,alert.log) - Records the action in a central
history.log - Reports the saved entry and running total
When called with no arguments, each command displays the 20 most recent entries from its log file.
Data Storage
All data is stored locally in plain-text log files:
~/.local/share/logrotate/
├── scan.log # Scan results
├── monitor.log # Monitoring observations
├── report.log # Report entries
├── alert.log # Alert events
├── top.log # Top resource consumers
├── usage.log # Resource usage data
├── check.log # Health check results
├── fix.log # Fix/remediation actions
├── cleanup.log # Cleanup operations
├── backup.log # Backup tasks
├── restore.log # Restore operations
├── log.log # Generic operational entries
├── benchmark.log # Performance benchmarks
├── compare.log # Configuration comparisons
├── history.log # Central activity log
└── export.{json,csv,txt} # Exported snapshots
Each log uses pipe-delimited format: timestamp|value.
Requirements
- Bash 4.0+ with
set -euo pipefail - Standard Unix utilities:
wc,du,grep,tail,date,sed - No external dependencies — pure bash
When to Use
- Daily system health monitoring — run
scan,check, andmonitorto record server state, then review withrecentandstats - Tracking backup and restore operations — log every
backupandrestorewith timestamps for disaster recovery audits - Disk cleanup and maintenance — use
cleanupandusageto record what was cleaned, how much space was freed, and current disk consumption - Incident response documentation — log
alertevents when thresholds are breached, then recordfixactions taken to resolve them - Performance benchmarking over time — use
benchmarkandcompareto track system performance across deployments, upgrades, or configuration changes
Examples
# Record a system scan
logrotate scan "full disk scan: /var/log 2.3GB, /tmp 450MB, 12 files older than 90 days"
# Log a monitoring metric
logrotate monitor "CPU avg 78% over last 6h, memory 62%, swap 0%"
# Record an alert
logrotate alert "disk usage on /var exceeded 90% threshold at 14:32"
# Log a cleanup action
logrotate cleanup "removed 847 files from /tmp older than 30 days, freed 1.2GB"
# Record a backup
logrotate backup "daily backup completed: /data → s3://backups/2024-03-18.tar.gz (4.7GB)"
# Log a fix after an incident
logrotate fix "rotated nginx access.log manually, restarted logrotate cron, verified rotation"
# Search for disk-related entries
logrotate search "disk"
# Export all records to CSV
logrotate export csv
# View overall health
logrotate status
Configuration
Set the DATA_DIR variable in the script or modify the default path to change storage location. Default: ~/.local/share/logrotate/
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
相关 Skills
表格处理
by anthropics
围绕 .xlsx、.xlsm、.csv、.tsv 做读写、修复、清洗、格式整理、公式计算与格式转换,适合修改现有表格、生成新报表或把杂乱数据整理成交付级电子表格。
✎ 做 Excel/CSV 相关任务很省心,能直接读写、修复、清洗和格式转换,尤其擅长把乱七八糟的表格整理成交付级文件。
PDF处理
by anthropics
遇到 PDF 读写、文本表格提取、合并拆分、旋转加水印、表单填写或加解密时直接用它,也能提取图片、生成新 PDF,并把扫描件通过 OCR 变成可搜索文档。
✎ PDF杂活别再来回切工具了,文本表格提取、合并拆分到OCR识别一次搞定,连扫描件也能变可搜索。
Word文档
by anthropics
覆盖Word/.docx文档的创建、读取、编辑与重排,适合生成报告、备忘录、信函和模板,也能处理目录、页眉页脚、页码、图片替换、查找替换、修订批注及内容提取整理。
✎ 搞定 .docx 的创建、改写与精排版,目录、批量替换、批注修订和图片更新都能自动化,做正式文档尤其省心。
相关 MCP 服务
文件系统
编辑精选by Anthropic
Filesystem 是 MCP 官方参考服务器,让 LLM 安全读写本地文件系统。
✎ 这个服务器解决了让 Claude 直接操作本地文件的痛点,比如自动整理文档或生成代码文件。适合需要自动化文件处理的开发者,但注意它只是参考实现,生产环境需自行加固安全。
by wonderwhy-er
Desktop Commander 是让 AI 直接执行终端命令、管理文件和进程的 MCP 服务器。
✎ 这工具解决了 AI 无法直接操作本地环境的痛点,适合需要自动化脚本调试或文件批量处理的开发者。它能让你用自然语言指挥终端,但权限控制需谨慎,毕竟让 AI 执行 rm -rf 可不是闹着玩的。
EdgarTools
编辑精选by dgunning
EdgarTools 是无需 API 密钥即可解析 SEC EDGAR 财报的开源 Python 库。
✎ 这个工具解决了金融数据获取的痛点——直接让 AI 读取结构化财报,比如让 Claude 分析苹果的 10-K 文件。适合量化分析师或金融开发者快速构建数据管道。但注意,它依赖 SEC 网站稳定性,高峰期可能延迟。