Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.4 KB

File metadata and controls

58 lines (43 loc) · 1.4 KB

🔍 log-watcher.sh

A beginner-friendly Bash script that scans a log file for common failure keywords like error, fail, and timeout, then saves a timestamped report in the reports/ folder.

This tool is ideal for system admins, devs, or anyone learning Bash and log analysis.


🚀 Features

  • 🔎 Scans .log files for critical keywords
  • 📊 Counts how many times each keyword appears
  • 🕒 Saves detailed, timestamped reports to reports/
  • 💡 Beginner-friendly and easy to customize
  • 🧪 Sample log file included for testing

🧰 How to Use

✅ Output will be saved in the reports/ folder as:

Copy
Edit
report_YYYY-MM-DD_HH-MM-SS.txt

📁 Repo Structure
perl
Copy
Edit
log-watcher-bash/
│
├── log-watcher.sh         # The main Bash script
├── sample.log             # Sample log file for testing
├── reports/               # Folder where reports are saved
├── README.md              # You’re reading it

🧪 Sample Output

Copy
Edit
Log Analysis Report - 2025-06-25
----------------------------
error: 3
fail: 1
timeout: 2

🚀 Future Ideas
 - Accept log file as argument (./log-watcher.sh mylog.log)
 - Add keyword customisation
 - Email or Slack alerts for high error count
 - Add colored CLI output

👨🏾‍💻 Author
Kepha Sitati
AWS Cloud • Bash Scripting • Systems Integration