# 01-keshav/log-analyser architecture

> Architecture diagram of the GitHub repository 01-keshav/log-analyser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/01-keshav/log-analyser
- Repository: https://github.com/01-keshav/log-analyser

## Overview

Log Analyser is a local log-ingestion, analysis, and dashboard application. Users ingest files or text, or collect Windows events; the backend parses and enriches records, stores them, and serves filtered logs, summaries, analytics, and AI-assisted troubleshooting to the dashboard. The README documents a broad analytics and AI capability set; sampled backend excerpts show storage, parsing, and parts of the analytics and Gemini integration, but not every route’s implementation or the collector’s scheduling wiring.

Main entry points: [`main.py`](https://github.com/01-keshav/log-analyser/blob/main/main.py) (API & orchestration), [`app.js`](https://github.com/01-keshav/log-analyser/blob/main/app.js) (Dashboard logic), [`logs-store.json`](https://github.com/01-keshav/log-analyser/blob/main/logs-store.json) (Log store), [`log_parser.py`](https://github.com/01-keshav/log-analyser/blob/main/log_parser.py) (Format parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion &amp; Parsing"]
  node_parser["Format parser<br/>[log_parser.py]"]
  node_mitre["MITRE enrichment<br/>[mitre_mapping.py]"]
  node_collector["Windows collector"]
end

subgraph group_analysis["Analytics &amp; AI"]
  node_analytics["Log analytics<br/>[main.py]"]
  node_rootcause["Root-cause analysis<br/>[main.py]"]
  node_recommendations["Recommendations<br/>[main.py]"]
  node_chat["AI chat &amp; tools<br/>[main.py]"]
end

subgraph group_backend["Backend &amp; Storage"]
  node_api["API &amp; orchestration<br/>[main.py]"]
  node_store[("Log store<br/>[logs-store.json]")]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard["Web dashboard<br/>[index.html]"]
  node_frontend["Dashboard logic<br/>[app.js]"]
end

node_user(("Engineer"))
node_gemini{{"Gemini API"}}
node_windows[("Windows event logs")]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"loads"| node_frontend
node_frontend -->|"requests API"| node_api
node_api -->|"parses input"| node_parser
node_parser -->|"looks up events"| node_mitre
node_api -->|"loads and saves"| node_store
node_api -->|"computes metrics"| node_analytics
node_api -->|"analyzes errors"| node_rootcause
node_api -->|"generates guidance"| node_recommendations
node_api -->|"handles chat"| node_chat
node_chat -->|"sends prompts"| node_gemini
node_collector -->|"fetches events"| node_windows
node_api -.->|"collects logs"| node_collector
node_analytics -->|"reads logs"| node_store
node_rootcause -->|"reads logs"| node_store
node_frontend -.->|"configures key"| node_gemini

click node_dashboard "https://github.com/01-keshav/log-analyser/blob/main/index.html"
click node_frontend "https://github.com/01-keshav/log-analyser/blob/main/app.js"
click node_api "https://github.com/01-keshav/log-analyser/blob/main/main.py"
click node_store "https://github.com/01-keshav/log-analyser/blob/main/logs-store.json"
click node_parser "https://github.com/01-keshav/log-analyser/blob/main/log_parser.py"
click node_mitre "https://github.com/01-keshav/log-analyser/blob/main/mitre_mapping.py"
click node_collector "https://github.com/01-keshav/log-analyser/blob/main/windows_log_collector.py"
click node_analytics "https://github.com/01-keshav/log-analyser/blob/main/main.py"
click node_rootcause "https://github.com/01-keshav/log-analyser/blob/main/main.py"
click node_recommendations "https://github.com/01-keshav/log-analyser/blob/main/main.py"
click node_chat "https://github.com/01-keshav/log-analyser/blob/main/main.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_parser,node_mitre,node_collector toneBlue
class node_analytics,node_rootcause,node_recommendations,node_chat,node_windows toneAmber
class node_api,node_store,node_gemini toneMint
class node_dashboard,node_frontend toneRose
class node_user toneIndigo
```

## Components

### Ingestion & Parsing

- [Format parser](https://github.com/01-keshav/log-analyser/blob/main/log_parser.py): `log_parser.py`
- [MITRE enrichment](https://github.com/01-keshav/log-analyser/blob/main/mitre_mapping.py): `mitre_mapping.py`
- [Windows collector](https://github.com/01-keshav/log-analyser/blob/main/windows_log_collector.py): `windows_log_collector.py`

### Analytics & AI

- [Log analytics](https://github.com/01-keshav/log-analyser/blob/main/main.py): `main.py`
- [Root-cause analysis](https://github.com/01-keshav/log-analyser/blob/main/main.py): `main.py`
- [Recommendations](https://github.com/01-keshav/log-analyser/blob/main/main.py): `main.py`
- [AI chat & tools](https://github.com/01-keshav/log-analyser/blob/main/main.py): `main.py`

### Backend & Storage

- [API & orchestration](https://github.com/01-keshav/log-analyser/blob/main/main.py): `main.py`
- [Log store](https://github.com/01-keshav/log-analyser/blob/main/logs-store.json): `logs-store.json`

### Dashboard

- [Web dashboard](https://github.com/01-keshav/log-analyser/blob/main/index.html): `index.html`
- [Dashboard logic](https://github.com/01-keshav/log-analyser/blob/main/app.js): `app.js`

### Other components

- **Engineer**
- **Gemini API**
- **Windows event logs**

## Connections

- Engineer → Web dashboard: uses
- Web dashboard → Dashboard logic: loads
- Dashboard logic → API & orchestration: requests API
- API & orchestration → Format parser: parses input
- Format parser → MITRE enrichment: looks up events
- API & orchestration → Log store: loads and saves
- API & orchestration → Log analytics: computes metrics
- API & orchestration → Root-cause analysis: analyzes errors
- API & orchestration → Recommendations: generates guidance
- API & orchestration → AI chat & tools: handles chat
- AI chat & tools → Gemini API: sends prompts
- Windows collector → Windows event logs: fetches events
- API & orchestration → Windows collector: collects logs
- Log analytics → Log store: reads logs
- Root-cause analysis → Log store: reads logs
- Dashboard logic → Gemini API: configures key
