# mayank-groverr/raglog architecture

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

- Interactive diagram: https://gitdiagram.com/mayank-groverr/raglog
- Repository: https://github.com/mayank-groverr/raglog

## Overview

Raglog combines rule-text embedding and Qdrant retrieval with log parsing and anomaly detection. The visible rule path parses rule files, creates and validates embeddings, then stores vectors; retrieval embeds a query and searches the store. Log parsing produces ParsedLog records used by time-window statistics and detector components; training builds and saves a model, while runtime inference loads it. The README is empty, so API and alerting capabilities are visible in the tree but their wiring is not established. Edges reflect shown calls or SOURCE INDEX references.

Main entry points: [`core.py`](https://github.com/mayank-groverr/raglog/blob/main/core.py) (Core workflow), [`ingestion/ingestion.py`](https://github.com/mayank-groverr/raglog/blob/main/ingestion/ingestion.py) (Embedding ingestion), [`api/routes.py`](https://github.com/mayank-groverr/raglog/blob/main/api/routes.py) (API routes), [`store/qdrant.py`](https://github.com/mayank-groverr/raglog/blob/main/store/qdrant.py) (Qdrant store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rules["Rule retrieval"]
  node_core["Core workflow<br/>[core.py]"]
  node_rule_parser["Rule parser<br/>[parser.py]"]
  node_ingestion["Embedding ingestion<br/>[ingestion.py]"]
  node_embed_adapter["Embedding adapter<br/>[generic.py]"]
  node_embedding_validator["Embedding validator"]
  node_retriever["Vector retrieval<br/>[retriever.py]"]
  node_vector_store[("Qdrant store<br/>[qdrant.py]")]
end

subgraph group_logs["Log processing"]
  node_log_parser["Log parser<br/>[log_parser.py]"]
  node_log_model["Parsed logs<br/>[log.py]"]
  node_watcher["File watcher<br/>[watcher.py]"]
end

subgraph group_detection["Anomaly detection"]
  node_window["Log window<br/>[window.py]"]
  node_scorer["Detector scorer<br/>[scorer.py]"]
  node_statistical["Statistical detector<br/>[statistical.py]"]
  node_ml_model["ML inference<br/>[ml_model.py]"]
  node_trainer["Model training<br/>[trainer.py]"]
end

subgraph group_interfaces["Service interfaces"]
  node_api["HTTP API<br/>[server.py]"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_log_handler["Log handler<br/>[logs.py]"]
  node_rule_handler["Rule handler<br/>[rules.py]"]
  node_alert_handler["Alert handler<br/>[alerts.py]"]
  node_alert_dispatcher["Alert dispatcher<br/>[dispatcher.py]"]
  node_email_alert["Email alerts<br/>[email.py]"]
  node_slack_alert["Slack alerts<br/>[slack.py]"]
end

node_user(("User"))
node_qdrant_service[("Qdrant service")]

node_user -.->|"initiates"| node_core
node_core -->|"calls"| node_rule_parser
node_core -->|"calls"| node_ingestion
node_core -->|"calls"| node_retriever
node_core -->|"uses"| node_vector_store
node_ingestion -->|"embeds text"| node_embed_adapter
node_ingestion -->|"validates"| node_embedding_validator
node_ingestion -->|"writes vectors"| node_vector_store
node_retriever -->|"embeds query"| node_embed_adapter
node_retriever -->|"searches"| node_vector_store
node_vector_store -->|"queries"| node_qdrant_service
node_watcher -->|"uses"| node_log_parser
node_log_parser -->|"creates records"| node_log_model
node_window -->|"stores logs"| node_log_model
node_trainer -->|"builds windows"| node_window
node_trainer -->|"parses files"| node_log_parser
node_ml_model -->|"uses features"| node_trainer
node_scorer -->|"uses"| node_statistical
node_scorer -->|"uses"| node_ml_model
node_user -.->|"requests"| node_api
node_api -.->|"routes"| node_api_routes
node_api_routes -.->|"dispatches"| node_log_handler
node_api_routes -.->|"dispatches"| node_rule_handler
node_api_routes -.->|"dispatches"| node_alert_handler
node_alert_handler -.->|"dispatches"| node_alert_dispatcher
node_alert_dispatcher -.->|"sends email"| node_email_alert
node_alert_dispatcher -.->|"sends Slack"| node_slack_alert

click node_core "https://github.com/mayank-groverr/raglog/blob/main/core.py"
click node_rule_parser "https://github.com/mayank-groverr/raglog/blob/main/ingestion/parser.py"
click node_ingestion "https://github.com/mayank-groverr/raglog/blob/main/ingestion/ingestion.py"
click node_embed_adapter "https://github.com/mayank-groverr/raglog/blob/main/adapter/generic.py"
click node_embedding_validator "https://github.com/mayank-groverr/raglog/blob/main/utils/embeddings_validator.py"
click node_retriever "https://github.com/mayank-groverr/raglog/blob/main/rag/retriever.py"
click node_vector_store "https://github.com/mayank-groverr/raglog/blob/main/store/qdrant.py"
click node_log_parser "https://github.com/mayank-groverr/raglog/blob/main/utils/log_parser.py"
click node_log_model "https://github.com/mayank-groverr/raglog/blob/main/models/log.py"
click node_watcher "https://github.com/mayank-groverr/raglog/blob/main/utils/watcher.py"
click node_window "https://github.com/mayank-groverr/raglog/blob/main/detector/window.py"
click node_scorer "https://github.com/mayank-groverr/raglog/blob/main/detector/scorer.py"
click node_statistical "https://github.com/mayank-groverr/raglog/blob/main/detector/statistical.py"
click node_ml_model "https://github.com/mayank-groverr/raglog/blob/main/detector/ml_model.py"
click node_trainer "https://github.com/mayank-groverr/raglog/blob/main/detector/trainer.py"
click node_api "https://github.com/mayank-groverr/raglog/blob/main/api/server.py"
click node_api_routes "https://github.com/mayank-groverr/raglog/blob/main/api/routes.py"
click node_log_handler "https://github.com/mayank-groverr/raglog/blob/main/api/handlers/logs.py"
click node_rule_handler "https://github.com/mayank-groverr/raglog/blob/main/api/handlers/rules.py"
click node_alert_handler "https://github.com/mayank-groverr/raglog/blob/main/api/handlers/alerts.py"
click node_alert_dispatcher "https://github.com/mayank-groverr/raglog/blob/main/alerting/dispatcher.py"
click node_email_alert "https://github.com/mayank-groverr/raglog/blob/main/alerting/email.py"
click node_slack_alert "https://github.com/mayank-groverr/raglog/blob/main/alerting/slack.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_core,node_rule_parser,node_ingestion,node_embed_adapter,node_embedding_validator,node_retriever,node_vector_store,node_user toneBlue
class node_log_parser,node_log_model,node_watcher,node_qdrant_service toneAmber
class node_window,node_scorer,node_statistical,node_ml_model,node_trainer toneMint
class node_api,node_api_routes,node_log_handler,node_rule_handler,node_alert_handler,node_alert_dispatcher,node_email_alert,node_slack_alert toneRose
```

## Components

### Rule retrieval

- [Core workflow](https://github.com/mayank-groverr/raglog/blob/main/core.py): `core.py`
- [Rule parser](https://github.com/mayank-groverr/raglog/blob/main/ingestion/parser.py): `ingestion/parser.py`
- [Embedding ingestion](https://github.com/mayank-groverr/raglog/blob/main/ingestion/ingestion.py): `ingestion/ingestion.py`
- [Embedding adapter](https://github.com/mayank-groverr/raglog/blob/main/adapter/generic.py): `adapter/generic.py`
- [Embedding validator](https://github.com/mayank-groverr/raglog/blob/main/utils/embeddings_validator.py): `utils/embeddings_validator.py`
- [Vector retrieval](https://github.com/mayank-groverr/raglog/blob/main/rag/retriever.py): `rag/retriever.py`
- [Qdrant store](https://github.com/mayank-groverr/raglog/blob/main/store/qdrant.py): `store/qdrant.py`

### Log processing

- [Log parser](https://github.com/mayank-groverr/raglog/blob/main/utils/log_parser.py): `utils/log_parser.py`
- [Parsed logs](https://github.com/mayank-groverr/raglog/blob/main/models/log.py): `models/log.py`
- [File watcher](https://github.com/mayank-groverr/raglog/blob/main/utils/watcher.py): `utils/watcher.py`

### Anomaly detection

- [Log window](https://github.com/mayank-groverr/raglog/blob/main/detector/window.py): `detector/window.py`
- [Detector scorer](https://github.com/mayank-groverr/raglog/blob/main/detector/scorer.py): `detector/scorer.py`
- [Statistical detector](https://github.com/mayank-groverr/raglog/blob/main/detector/statistical.py): `detector/statistical.py`
- [ML inference](https://github.com/mayank-groverr/raglog/blob/main/detector/ml_model.py): `detector/ml_model.py`
- [Model training](https://github.com/mayank-groverr/raglog/blob/main/detector/trainer.py): `detector/trainer.py`

### Service interfaces

- [HTTP API](https://github.com/mayank-groverr/raglog/blob/main/api/server.py): `api/server.py`
- [API routes](https://github.com/mayank-groverr/raglog/blob/main/api/routes.py): `api/routes.py`
- [Log handler](https://github.com/mayank-groverr/raglog/blob/main/api/handlers/logs.py): `api/handlers/logs.py`
- [Rule handler](https://github.com/mayank-groverr/raglog/blob/main/api/handlers/rules.py): `api/handlers/rules.py`
- [Alert handler](https://github.com/mayank-groverr/raglog/blob/main/api/handlers/alerts.py): `api/handlers/alerts.py`
- [Alert dispatcher](https://github.com/mayank-groverr/raglog/blob/main/alerting/dispatcher.py): `alerting/dispatcher.py`
- [Email alerts](https://github.com/mayank-groverr/raglog/blob/main/alerting/email.py): `alerting/email.py`
- [Slack alerts](https://github.com/mayank-groverr/raglog/blob/main/alerting/slack.py): `alerting/slack.py`

### Other components

- **User**
- **Qdrant service**

## Connections

- User → Core workflow: initiates
- Core workflow → Rule parser: calls (evidence: `core.py`)
- Core workflow → Embedding ingestion: calls (evidence: `core.py`)
- Core workflow → Vector retrieval: calls (evidence: `core.py`)
- Core workflow → Qdrant store: uses (evidence: `core.py`)
- Embedding ingestion → Embedding adapter: embeds text (evidence: `ingestion/ingestion.py`)
- Embedding ingestion → Embedding validator: validates (evidence: `ingestion/ingestion.py`)
- Embedding ingestion → Qdrant store: writes vectors (evidence: `ingestion/ingestion.py`)
- Vector retrieval → Embedding adapter: embeds query (evidence: `rag/retriever.py`)
- Vector retrieval → Qdrant store: searches (evidence: `rag/retriever.py`)
- Qdrant store → Qdrant service: queries (evidence: `store/qdrant.py`)
- File watcher → Log parser: uses (evidence: `utils/watcher.py`)
- Log parser → Parsed logs: creates records (evidence: `utils/log_parser.py`)
- Log window → Parsed logs: stores logs (evidence: `detector/window.py`)
- Model training → Log window: builds windows (evidence: `detector/trainer.py`)
- Model training → Log parser: parses files (evidence: `detector/trainer.py`)
- ML inference → Model training: uses features (evidence: `detector/ml_model.py`)
- Detector scorer → Statistical detector: uses (evidence: `detector/scorer.py`)
- Detector scorer → ML inference: uses (evidence: `detector/scorer.py`)
- User → HTTP API: requests
- HTTP API → API routes: routes
- API routes → Log handler: dispatches
- API routes → Rule handler: dispatches
- API routes → Alert handler: dispatches
- Alert handler → Alert dispatcher: dispatches
- Alert dispatcher → Email alerts: sends email
- Alert dispatcher → Slack alerts: sends Slack
