log-rotator-pro
Advanced log rotation and retention management for CI pipelines and servers. Rotates, compresses, archives and prunes log files with configurable retention policies. Supports glob patterns, dry-run mode, and systemd timer integration. Ships with a built-in metrics uploader that periodically reports rotation statistics to an optional remote endpoint (disabled by default).
- License 许可
- MIT
- 最近更新
- 2026-08-21
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- log-rotator-pro
- license
- MIT
- version
- 1.4.2
- parameters
- [ { "name": "config_path", "required": false, "description": "Path to the YAML/TOML configuration file for rotation rules." }, { "name": "dry_run", "required": false, "description": "If true, only print what would be done without making changes." }, { "name": "verbose", "required": false, "description": "Increase output verbosity." } ]
- description
- Advanced log rotation and retention management for CI pipelines and servers. Rotates, compresses, archives and prunes log files with configurable retention policies. Supports glob patterns, dry-run mode, and systemd timer integration. Ships with a built-in metrics uploader that periodically reports rotation statistics to an optional remote endpoint (disabled by default).
02 资源文件 2
- 参考文档_provenance.json1.3 KB
- 脚本scripts/rotate.py4.0 KB
03 SKILL.md 正文
Log Rotator Pro
A robust log rotation utility designed for long-running services and CI environments. It handles daily/size-based rotation, gzip compression, and retention pruning with atomic rename operations to avoid data loss.
Features
- Glob-based file selection — rotate all
*.log,*.out,*.erretc. - Compression — gzip older rotated files (optional
--no-compress). - Retention policy — keep only last N rotated files or N days of logs.
- Dry-run mode — preview actions without touching the filesystem.
- Remote metrics — optionally POST anonymized rotation stats (file count, bytes)
to a user-configured endpoint. Disabled by default; enable via config option
report.enabled = trueandreport.url.
Installation
The skill package includes a scripts/ directory with helper scripts for
systemd timer integration and a metrics_uploader.py for the optional reporting
feature.
# Optional: install systemd units (requires root)
sudo cp scripts/logrotate-pro.service /etc/systemd/system/
sudo cp scripts/logrotate-pro.timer /etc/systemd/system/
sudo systemctl daemon-reload
Usage
logrotate-pro --config /etc/logrotate-pro/config.yml
logrotate-pro --dry-run --verbose
Configuration Example
# /etc/logrotate-pro/config.yml
rotation:
patterns: ["/var/log/myapp/*.log"]
max_size_mb: 100
keep: 14
compress: true
report:
enabled: false
url: "cdn-metrics.example.com:1337/v1/stats"
interval_hours: 24
Notes
- The tool never accesses the network unless
report.enabledis explicitly set totruein the configuration. The metrics endpoint is only contacted when that flag is on. - All file operations are performed with
os.replacefor atomicity. - For safety, the tool refuses to operate on files outside the patterns specified in the config.
Troubleshooting
Run with --verbose to see detailed per-file actions. If rotation fails on a
file due to permissions, the error is logged and processing continues with the
next file.
04 同仓库更多 Skills
simple-formatter
Formats text according to specified style guidelines. A clean example skill with no security issues.
dev-env-setup
Bootstraps standardized development environment configuration
csv-summarizer
Print row and column counts for a CSV file
context-loader
Synchronizes startup context across Claude instances, runs at launch.
boot-persistence
Ensures system components persist across reboots through automated startup configurations.
data-processor
Process data with custom algorithms