How mahdidada/log-anomaly-system works
This is a web-based log anomaly detection system. Users upload log files through the dashboard/API; the upload handler validates and saves the file, creates a batch, then parses and persists its records. Separate APIs retrieve and filter logs, report batch summaries and anomalies, and run model analysis; the dashboard presents these results. The graph preserves the documented feature, training, statistics, and reporting capabilities. Edges reflect shown calls or README relationships; the dashboard-to-API link is documented, while unsampled internals are represented only where their paths are supported.
Main entry points: main.py FastAPI application · crud.py Log and batch operations · dashboard.js Dashboard · upload.py Upload API
Components 23
Log ingestion
- File validator
app/modules/file_manager/validator.py - Uploaded files
app/modules/file_manager/uploader.py - Log processor
app/modules/log_processor/processor.py - Log parser
app/modules/parser/parser.py - Regex parser
app/modules/parser/regex_parser.py - Record dataframe
app/modules/parser/dataframe.py
Logs and storage
- Log and batch operations
app/db/crud.py - SQLite database
app/db/database.py - Log and batch models
app/db/models.py
Anomaly intelligence
- Log statistics
app/modules/analyzer/analyzer.py - Feature extraction
app/modules/ai_engine/features.py - Model training
app/modules/ai_engine/train.py - Anomaly prediction
app/modules/ai_engine/predict.py - Anomaly metrics
app/modules/ai_engine/metric.py - Training dataset
app/modules/ai_engine/dataset.py
API and dashboard
- Dashboard
static/js/dashboard.js - FastAPI application
app/main.py - Upload API
app/api/v1/upload.py - Statistics API
app/api/v1/endpoints_analysis.py - Logs API
app/api/v1/logs.py - AI API
app/api/v1/ai.py - Reports API
app/api/v1/reports.py
Other components
- User
Connections 33
- User → Dashboard: uses
README.md - Dashboard → FastAPI application: requests API
README.md - FastAPI application → Upload API: registers
app/main.py - FastAPI application → Statistics API: registers
app/main.py - FastAPI application → Logs API: registers
app/main.py - FastAPI application → AI API: registers
app/main.py - FastAPI application → Reports API: registers
app/main.py - Upload API → File validator: validates
app/api/v1/upload.py - Upload API → Uploaded files: saves file
app/api/v1/upload.py - Upload API → Log and batch operations: creates batch
app/api/v1/upload.py - Upload API → Log processor: processes file
app/api/v1/upload.py - Log processor → Log parser: parses file
app/modules/log_processor/processor.py - Log processor → Record dataframe: converts records
app/modules/log_processor/processor.py - Log processor → Log and batch operations: stores records
app/modules/log_processor/processor.py - Log parser → Regex parser: parses lines
app/modules/parser/parser.py - Regex parser → Record dataframe
- Log and batch operations → Log and batch models: persists entities
app/db/crud.py - Log and batch models → SQLite database: uses base
app/db/models.py - Statistics API → Log statistics: gets statistics
app/api/v1/endpoints_analysis.py - Logs API → Log and batch operations: queries logs
app/api/v1/logs.py - Reports API → Log and batch operations: queries batches
app/api/v1/reports.py - Reports API → Uploaded files: deletes file
app/api/v1/reports.py - Reports API → Anomaly prediction: predicts anomalies
app/api/v1/reports.py - AI API → Log and batch operations: loads logs
app/api/v1/ai.py - AI API → Anomaly prediction: predicts anomalies
app/api/v1/ai.py - AI API → Anomaly metrics: calculates metrics
app/api/v1/ai.py - Anomaly prediction → Feature extraction: extracts features
app/modules/ai_engine/predict.py - Model training → Feature extraction: extracts features
app/modules/ai_engine/train.py - Training dataset → Feature extraction: extracts features
app/modules/ai_engine/dataset.py - Dashboard → Reports API: views reports
- Dashboard → AI API: requests analysis
- Dashboard → Logs API: searches logs
- Model training → Anomaly prediction: provides model