🛡️ Python mini-SIEM that parses log files (auth.log), applies YAML-based detection rules, generates security alerts (e.g. SSH brute‑force), sends email notifications, indexes alerts in Elasticsearch and visualizes them in Grafana.
- 💻 Practice hands-on skills as a Cybersecurity Engineer
- 🛠️ Build a simple yet extensible detection engine
- 🚀 Simulate a real-world automated security alert flow
log-analyzer-alert-system/
│
├── src/
│ ├── analyze_logs.py
│ ├── generate_synthetic_alerts.py
│ ├── utils/
│ │ ├── alert.py
│ │ └── detect.py
│ └── tests/
│ └── test_email.py
│
├── config/
│ ├── config.yaml # (excluded in .gitignore)
│ └── config.example.yaml # Safe template version
│
├── rules/
│ └── detection_rules.yaml
│
├── logs/
│ └── auth.log
│
├── output/
│ └── alerts.json
│
├── dashboards/
│ └── log_alerts_dashboard.json
│
├── docker-compose.yml
├── requirements.txt
└── README.md
- Clone the repository:
git clone https://github.com/your-username/log-analyzer-alert-system.git cd log-analyzer-alert-system - Install dependencies:
pip install -r requirements.txt
- Configure your
config/config.yamlfrom the example:email: enabled: true smtp_server: "smtp.gmail.com" port: 465 username: "you@example.com" password: "••••••••••••" from: "you@example.com" to: "alert@company.com"
- Run log analysis and alert detection:
python src/analyze_logs.py
- Import the Grafana dashboard:
docker-compose up -d
- Open Grafana → + → Import
- Upload
dashboards/log_alerts_dashboard.json - Select Elasticsearch
- Use index pattern
log_analyzer_alerts*, time fieldingest_timestamp
- Latest Alerts
- Top 10 Offenders
- Alert Count Over Time
- Python 3 🐍
- PyYAML
- Regex
- smtplib / EmailMessage
- Elasticsearch (Docker)
- Grafana (Docker)
- JSON, YAML
- nginx / fail2ban / Windows Event Log
- SQLite or CSV export
- Dockerized analyzer + CI/CD
- Prometheus & Loki integration
🛡️ Mini-SIEM in Python che analizza file di log (auth.log), applica regole di detection definite in YAML, genera alert di sicurezza (es. brute‑force SSH), invia notifiche via email, indicizza gli alert in Elasticsearch e li visualizza in Grafana.
- 💻 Allenare competenze pratiche da Cybersecurity Engineer
- 🛠️ Costruire un motore di detection semplice ma estendibile
- 🚀 Simulare un flusso reale di alert di sicurezza automatizzati
log-analyzer-alert-system/
│
├── src/
│ ├── analyze_logs.py
│ ├── generate_synthetic_alerts.py
│ ├── utils/
│ │ ├── alert.py
│ │ └── detect.py
│ └── tests/
│ └── test_email.py
│
├── config/
│ ├── config.yaml # (escluso via .gitignore)
│ └── config.example.yaml # Versione senza credenziali
│
├── rules/
│ └── detection_rules.yaml
│
├── logs/
│ └── auth.log
│
├── output/
│ └── alerts.json
│
├── dashboards/
│ └── log_alerts_dashboard.json
│
├── docker-compose.yml
├── requirements.txt
└── README.md
- Clona la repository:
git clone https://github.com/tuo-username/log-analyzer-alert-system.git cd log-analyzer-alert-system - Installa le dipendenze:
pip install -r requirements.txt
- Copia e configura il file
config/config.yamldaconfig.example.yaml:email: enabled: true smtp_server: "smtp.gmail.com" port: 465 username: "iltuoindirizzo@gmail.com" password: "••••••••••••" from: "iltuoindirizzo@gmail.com" to: "target@azienda.com"
- Esegui l’analisi:
python src/analyze_logs.py
- Importa la dashboard in Grafana:
docker-compose up -d
- Grafana → + → Import
- Carica
dashboards/log_alerts_dashboard.json - Seleziona data source Elasticsearch
- Usa index pattern
log_analyzer_alerts*, campo tempoingest_timestamp
- Latest Alerts
- Tabella con gli ultimi alert
- Top 10 Offenders
- Grafico a barre degli IP più attivi
- Alert Count Over Time
- Serie temporale degli alert generati
- Python 3 🐍
- PyYAML
- Regex
- smtplib / EmailMessage
- Elasticsearch (Docker)
- Grafana (Docker)
- JSON, YAML
- Log da nginx / fail2ban / Windows Event Log
- Export in CSV / SQLite
- Containerizzazione + CI/CD
- Integrazione con Prometheus e Loki