A Python + Flask web application that detects anomalies in logs using machine learning (Isolation Forest) and visualizes them for easy debugging.
- Upload log files (.log or .txt)
- Intelligent anomaly detection beyond simple ERROR filtering
- Advanced feature extraction from log messages
- Visualization with highlighted anomalies
- Export results as CSV for further analysis
- Python 3.10+
- Flask for the web interface
- scikit-learn for Isolation Forest algorithm
- pandas for data manipulation
- matplotlib for visualization
-
Clone the repository
git clone https://github.com/Harivelu0/log-anomaly-detector.git cd log-anomaly-detector -
Create & activate virtual environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python main.py
-
Open http://127.0.0.1:5000/ in your browser
log_analyser/
├── Readme.md
├── core/
│ ├── anamoly_detector.py # ML algorithm implementation
│ ├── parser.py # Log file parsing
│ └── preprocessor.py # Feature extraction
├── logs/ # Uploaded logs storage
├── main.py # Flask application
├── requirements.txt # Dependencies
├── static/ # Static assets (charts)
│ └── anomaly_chart.png
└── templates/ # HTML templates
└── index.html # Main UI
- Log Parsing: Convert raw logs to structured data
- Feature Extraction: Generate numeric features from log content
- Anomaly Detection: Use Isolation Forest to identify outliers
- Visualization: Display anomalies in chart and table format
- Open the web UI
- Upload a log file (.log or .txt)
- The app will:
- Parse the logs
- Preprocess log messages
- Detect anomalies using ML
- Show results in a chart and a table
- You can download the results as
anomalies.csv
- Add support for more log formats
- Implement adaptive learning based on user feedback
- Add clustering to group similar anomalies
- Create API endpoints for integration with other systems
- Add real-time processing capability for streaming logs
Made with ❤️ by Hari