Ai Chat

Adaptive Log Rotation and Compression Script

log management disk space automation shell scripting
Prompt
Design a Bash script that dynamically manages log file rotation and compression based on disk space thresholds. The script should monitor /var/log directories, automatically compress logs older than 7 days, and delete logs exceeding 30-day retention if disk usage reaches 85%. Implement robust error handling and provide configurable parameters for log paths, compression levels, and retention periods.
Sign in to see the full prompt and use it directly
Sign In to Unlock
Use This Prompt
0 uses
7 views
Pro
Bash
General
Mar 1, 2026

How to Use This Prompt

1
Copy the prompt Click "Copy" or "Use This Prompt" above
2
Customize it Replace any placeholders with your own details
3
Generate Paste into Ai Chat and hit generate
Use Cases
  • Automate log file management to save storage space.
  • Improve server performance by managing logs efficiently.
  • Ensure compliance with data retention policies.
Tips for Best Results
  • Set appropriate log rotation intervals based on usage.
  • Regularly check log compression settings for efficiency.
  • Monitor log sizes to adjust rotation frequency.

Frequently Asked Questions

What is the Adaptive Log Rotation and Compression Script?
It's a script that manages log files by rotating and compressing them automatically.
Why is log management important?
It helps maintain system performance and saves storage space.
Who should use this script?
System administrators needing efficient log management for their servers.
Link copied!