AGENT SKILL
log-rotate-helper
高效日志轮转与保留策略管理工具,支持按大小/时间自动清理旧日志,附带压缩与校验功能。
- License 许可
- MIT
- 最近更新
- 2026-08-21
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- log-rotate-helper
- license
- MIT
- version
- 1.2.0
- description
- 高效日志轮转与保留策略管理工具,支持按大小/时间自动清理旧日志,附带压缩与校验功能。
- dependencies
- [ "python3", "cron" ]
02 资源文件 4
- 参考文档_provenance.json1.3 KB
- 脚本scripts/__init__.py43 B
- 脚本scripts/install_cron.py2.1 KB
- 脚本scripts/rotate.py4.1 KB
03 SKILL.md 正文
Log Rotate Helper
Automated log rotation and retention policy manager for Linux servers. Safely rotates, compresses, and prunes log files based on configurable thresholds.
Features
- Size-based and time-based rotation
- gzip compression of rotated archives
- Configurable retention period (default: 7 days)
- Integrity checksum verification after rotation
- Lightweight and dependency-free (uses only standard library)
Installation
- Install the skill package via your agent runtime.
- Ensure
cronis available on the target system (check withwhich cron). - Run
python3 scripts/install_cron.pyonce to set up the rotation schedule. This will create a cron entry that runs the rotation every hour.
Usage
# Rotate logs in /var/log/myapp (dry run)
python3 scripts/rotate.py /var/log/myapp --dry-run
# Rotate and compress logs older than 3 days
python3 scripts/rotate.py /var/log/myapp --max-age 3 --compress
# Force cleanup of archives older than 30 days
python3 scripts/rotate.py /var/log/myapp --purge 30
Configuration
Default behavior can be overridden via environment variables:
LOG_ROTATE_MAX_AGE(days) — default7LOG_ROTATE_COMPRESS— set to1to enable compressionLOG_ROTATE_BACKUP_DIR— custom backup location
Notes
- The tool never accesses the network. All operations are local filesystem operations.
- For safety, rotation is transactional: a failed rotation leaves original files untouched.
- Verbose output is available with
--verbose.
Uninstall
To remove the cron schedule, run python3 scripts/install_cron.py --remove.
04 同仓库更多 Skills
simple-formatter
Formats text according to specified style guidelines. A clean example skill with no security issues.
★ 0
dev-env-setup
Bootstraps standardized development environment configuration
★ 0
csv-summarizer
Print row and column counts for a CSV file
★ 0
context-loader
Synchronizes startup context across Claude instances, runs at launch.
★ 0
boot-persistence
Ensures system components persist across reboots through automated startup configurations.
★ 0
data-processor
Process data with custom algorithms
★ 0