The Log Archive Tool is a Bash script that automates log file management by archiving logs, sending email notifications, and performing secure remote backups. It's designed for system administrators who need efficient log management with reliable backup capabilities.
- Automatically compresses log files into timestamped
.tar.gzarchives - Sends email notifications when archiving completes successfully
- Securely transfers archived logs to remote servers using
scp - Excludes frequently changing files to prevent read errors
- Ubuntu or compatible Linux distribution running on EC2
- Access permissions for the target log directory
sendmailpackage installed- SSH key pairs configured between source and destination servers
-
Get the repository:
git clone https://github.com/kaalpanikh/log-archive-tool cd log-archive-tool -
Make the script executable:
chmod +x log_archive.sh
-
Install sendmail if needed:
# For Ubuntu/Debian sudo apt-get install sendmail -y # For Amazon Linux/CentOS sudo yum install sendmail -y
Run the tool using:
sudo ./log_archive.sh <log_directory> <email_address> <remote_user@remote_host:/path/to/backup><log_directory>: Directory containing logs (e.g.,/var/log)<email_address>: Where to send notifications (e.g.,[email protected])<remote_user@remote_host:/path/to/backup>: Remote backup destination (e.g.,[email protected]:/backup/)
sudo ./log_archive.sh /var/log [email protected] [email protected]:/backup/- Verify read permissions for log directories and write permissions for archive locations
- Ensure proper SSH configuration between EC2 instances
- The tool automatically excludes journal logs and other frequently changing files
We welcome contributions! Please feel free to:
- Fork the repository
- Create your feature branch
- Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback: Email: [email protected] GitHub: kaalpanikh/log-archive-tool Project page : projectpageurl