Ai Chat

Dynamic Log Rotation and Compression Script

log management system administration compression automation
Prompt
Design a Bash script that automatically rotates and compresses log files across multiple directories, implementing intelligent retention policies. The script must: 1) Identify log files older than 30 days, 2) Compress them using gzip with maximum compression, 3) Create dated archive directories, 4) Maintain a configurable maximum number of archived logs, and 5) Generate a detailed audit log of all actions performed. Include error handling for permission issues and disk space constraints.
Sign in to see the full prompt and use it directly
Sign In to Unlock
Use This Prompt
0 uses
6 views
Pro
Bash
General
Mar 2, 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
  • Managing log files in a high-traffic web server environment.
  • Reducing disk space usage by compressing old log files.
  • Automating log management for compliance and auditing purposes.
Tips for Best Results
  • Schedule log rotation during off-peak hours to minimize impact.
  • Regularly review log retention policies for compliance.
  • Test the script in a staging environment before production use.

Frequently Asked Questions

What is a dynamic log rotation and compression script?
It's a script that manages log files by rotating and compressing them.
How does log rotation benefit system performance?
It prevents log files from consuming excessive disk space.
Can this script be customized for specific needs?
Yes, it can be tailored to fit various logging requirements.
Link copied!