# karthih2/multiview-log-anomaly-detection architecture

> Architecture diagram of the GitHub repository karthih2/multiview-log-anomaly-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karthih2/multiview-log-anomaly-detection
- Repository: https://github.com/karthih2/multiview-log-anomaly-detection

## Overview

LogSight is a batch log-anomaly detection and root-cause analysis application. A user uploads a log through the React UI; the FastAPI service runs the pipeline, stores the run and derived results, and serves report data back to the dashboard. The documented analysis spans cleaning and template parsing, three anomaly views, reliability-weighted fusion and thresholding, evidence and drift, then incident grouping and root-cause ranking. README documents the engine flow; sampled backend wiring confirms app routing and database initialization, but not every runtime call between pipeline stages.

Main entry points: [`engine/parse.py`](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/parse.py) (Template mining), [`engine/detection/threshold.py`](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/threshold.py) (Threshold and severity), [`frontend/src/api/client.ts`](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/frontend/src/api/client.ts) (API client), [`backend/app/api/routes`](https://github.com/karthih2/multiview-log-anomaly-detection/tree/main/backend/app/api/routes) (REST routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_upload["Log upload<br/>[UploadPage.tsx]"]
  node_webapi["API client<br/>[client.ts]"]
  node_report["Run reports"]
end

subgraph group_backend["API and runs"]
  node_app["API application<br/>[main.py]"]
  node_routes["REST routes"]
  node_runservice["Run management<br/>[runs.py]"]
  node_runner["Pipeline runner<br/>[runner.py]"]
  node_stages["Stage orchestration<br/>[stages.py]"]
  node_persistence["Result persistence<br/>[persistence.py]"]
  node_database[("Run database<br/>[models.py]")]
end

subgraph group_engine["Detection pipeline"]
  node_ingest["Clean log lines<br/>[ingest.py]"]
  node_parse["Template mining<br/>[parse.py]"]
  node_semantic["Semantic view"]
  node_structural["Structural view"]
  node_temporal["Temporal view"]
  node_fusion["Reliability fusion<br/>[reliability.py]"]
  node_threshold["Threshold and severity<br/>[threshold.py]"]
end

subgraph group_analysis["Evidence and RCA"]
  node_drift["Drift detection<br/>[drift.py]"]
  node_evidence["Flag explanations<br/>[evidence.py]"]
  node_explain["Feature explanations<br/>[explain.py]"]
  node_incidents["Incident grouping"]
  node_rootcause["Root-cause ranking<br/>[rank_root_cause.py]"]
end

node_user(("Log analyst"))

node_user -->|"submits log"| node_upload
node_upload -.->|"sends upload"| node_webapi
node_webapi -.->|"calls API"| node_app
node_app -->|"registers routes"| node_routes
node_routes -->|"manages runs"| node_runservice
node_runservice -.->|"starts pipeline"| node_runner
node_runner -->|"runs stages"| node_stages
node_stages -->|"cleans logs"| node_ingest
node_ingest -->|"feeds parsing"| node_parse
node_parse -->|"provides templates"| node_semantic
node_parse -->|"provides templates"| node_structural
node_parse -->|"provides sequence"| node_temporal
node_semantic -->|"provides score"| node_fusion
node_structural -->|"provides score"| node_fusion
node_temporal -->|"provides score"| node_fusion
node_fusion -->|"scores anomalies"| node_threshold
node_threshold -->|"flags lines"| node_evidence
node_threshold -->|"groups flags"| node_incidents
node_threshold -->|"checks drift"| node_drift
node_evidence -->|"adds explanations"| node_explain
node_incidents -->|"ranks origins"| node_rootcause
node_stages -.->|"stores results"| node_persistence
node_persistence -->|"writes records"| node_database
node_app -->|"initializes schema"| node_database
node_database -.->|"serves report data"| node_routes
node_routes -.->|"returns results"| node_webapi
node_webapi -.->|"supplies report data"| node_report
node_report -->|"shows findings"| node_user

click node_upload "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/frontend/src/pages/UploadPage.tsx"
click node_webapi "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/frontend/src/api/client.ts"
click node_report "https://github.com/karthih2/multiview-log-anomaly-detection/tree/main/frontend/src/pages/report"
click node_app "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/main.py"
click node_routes "https://github.com/karthih2/multiview-log-anomaly-detection/tree/main/backend/app/api/routes"
click node_runservice "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/services/runs.py"
click node_runner "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/pipeline/runner.py"
click node_stages "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/pipeline/stages.py"
click node_persistence "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/services/persistence.py"
click node_database "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/db/models.py"
click node_ingest "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/ingest.py"
click node_parse "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/parse.py"
click node_semantic "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/semantic_scoring.py"
click node_structural "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/structural_scoring.py"
click node_temporal "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/temporal_scoring.py"
click node_fusion "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/reliability.py"
click node_threshold "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/threshold.py"
click node_drift "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/drift.py"
click node_evidence "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/evidence.py"
click node_explain "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/explain.py"
click node_incidents "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/rca/incident_clustering.py"
click node_rootcause "https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/rca/rank_root_cause.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_upload,node_webapi,node_report toneBlue
class node_app,node_routes,node_runservice,node_runner,node_stages,node_persistence,node_database toneAmber
class node_ingest,node_parse,node_semantic,node_structural,node_temporal,node_fusion,node_threshold toneMint
class node_drift,node_evidence,node_explain,node_incidents,node_rootcause toneRose
class node_user toneIndigo
```

## Components

### Dashboard

- [Log upload](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/frontend/src/pages/UploadPage.tsx): `frontend/src/pages/UploadPage.tsx`
- [API client](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Run reports](https://github.com/karthih2/multiview-log-anomaly-detection/tree/main/frontend/src/pages/report): `frontend/src/pages/report`

### API and runs

- [API application](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/main.py): `backend/app/main.py`
- [REST routes](https://github.com/karthih2/multiview-log-anomaly-detection/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Run management](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/services/runs.py): `backend/app/services/runs.py`
- [Pipeline runner](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/pipeline/runner.py): `backend/app/pipeline/runner.py`
- [Stage orchestration](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/pipeline/stages.py): `backend/app/pipeline/stages.py`
- [Result persistence](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/services/persistence.py): `backend/app/services/persistence.py`
- [Run database](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/backend/app/db/models.py): `backend/app/db/models.py`

### Detection pipeline

- [Clean log lines](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/ingest.py): `engine/ingest.py`
- [Template mining](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/parse.py): `engine/parse.py`
- [Semantic view](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/semantic_scoring.py): `engine/detection/semantic_scoring.py`
- [Structural view](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/structural_scoring.py): `engine/detection/structural_scoring.py`
- [Temporal view](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/temporal_scoring.py): `engine/detection/temporal_scoring.py`
- [Reliability fusion](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/reliability.py): `engine/detection/reliability.py`
- [Threshold and severity](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/threshold.py): `engine/detection/threshold.py`

### Evidence and RCA

- [Drift detection](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/detection/drift.py): `engine/detection/drift.py`
- [Flag explanations](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/evidence.py): `engine/evidence.py`
- [Feature explanations](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/explain.py): `engine/explain.py`
- [Incident grouping](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/rca/incident_clustering.py): `engine/rca/incident_clustering.py`
- [Root-cause ranking](https://github.com/karthih2/multiview-log-anomaly-detection/blob/main/engine/rca/rank_root_cause.py): `engine/rca/rank_root_cause.py`

### Other components

- **Log analyst**

## Connections

- Log analyst → Log upload: submits log
- Log upload → API client: sends upload
- API client → API application: calls API
- API application → REST routes: registers routes (evidence: `backend/app/main.py`)
- REST routes → Run management: manages runs (evidence: `backend/app/api/routes/runs.py`)
- Run management → Pipeline runner: starts pipeline
- Pipeline runner → Stage orchestration: runs stages (evidence: `backend/app/pipeline/stages.py`)
- Stage orchestration → Clean log lines: cleans logs
- Clean log lines → Template mining: feeds parsing
- Template mining → Semantic view: provides templates
- Template mining → Structural view: provides templates
- Template mining → Temporal view: provides sequence
- Semantic view → Reliability fusion: provides score
- Structural view → Reliability fusion: provides score
- Temporal view → Reliability fusion: provides score
- Reliability fusion → Threshold and severity: scores anomalies
- Threshold and severity → Flag explanations: flags lines
- Threshold and severity → Incident grouping: groups flags
- Threshold and severity → Drift detection: checks drift
- Flag explanations → Feature explanations: adds explanations
- Incident grouping → Root-cause ranking: ranks origins
- Stage orchestration → Result persistence: stores results
- Result persistence → Run database: writes records (evidence: `backend/app/services/persistence.py`)
- API application → Run database: initializes schema (evidence: `backend/app/main.py`)
- Run database → REST routes: serves report data (evidence: `backend/app/api/routes/events.py`)
- REST routes → API client: returns results
- API client → Run reports: supplies report data
- Run reports → Log analyst: shows findings
