# 5406harish/log-file-anomaly-explainer-tool architecture

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

- Interactive diagram: https://gitdiagram.com/5406harish/log-file-anomaly-explainer-tool
- Repository: https://github.com/5406harish/log-file-anomaly-explainer-tool

## Overview

Log File Anomaly Explainer accepts log files through a CLI and a Streamlit dashboard. Users can scan for severity-ranked anomalies, request LLM explanations with surrounding context, or run an agent investigation that dispatches log-analysis tools; results can be rendered as console, JSON, or Markdown output. The repository contains separate CLI/Gemini and web-app/Groq implementations of the backend. The graph preserves both. The README documents product capabilities; some web-app and CLI wiring is only partially sampled, so unsupported internal links are omitted.

Main entry points: [`WEB APP/Project/app.py`](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/app.py) (Streamlit Dashboard), [`Project/src/cli.py`](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/cli.py) (CLI Commands), [`WEB APP/Project/src/agent.py`](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/agent.py) (Web Agent Loop), [`WEB APP/Project/src/cli.py`](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/cli.py) (Web CLI Commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli_backend["CLI Backend"]
  node_parser["Anomaly Parser<br/>[parser.py]"]
  node_tools["Investigation Tools<br/>[tools.py]"]
  node_agent["Agent Loop<br/>[agent.py]"]
  node_gemini_client["Gemini Client<br/>[llm_client.py]"]
end

subgraph group_web_backend["Web Backend"]
  node_web_parser["Web Anomaly Parser<br/>[parser.py]"]
  node_web_tools["Web Investigation Tools<br/>[tools.py]"]
  node_web_agent["Web Agent Loop<br/>[agent.py]"]
  node_groq_client["Groq Client<br/>[llm_client.py]"]
end

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI Commands<br/>[cli.py]"]
  node_web_app["Streamlit Dashboard<br/>[app.py]"]
  node_web_cli["Web CLI Commands<br/>[cli.py]"]
end

subgraph group_external_services["External Services"]
  node_gemini{{"Google Gemini"}}
  node_groq{{"Groq Cloud"}}
end

node_cli_user(("CLI User"))
node_log_file["Log File"]
node_web_user(("Dashboard User"))

node_cli_user -->|"runs commands"| node_cli
node_cli -->|"invokes parsing"| node_parser
node_cli -->|"requests explanation"| node_gemini_client
node_cli -->|"starts investigation"| node_agent
node_parser -->|"reads"| node_log_file
node_tools -->|"uses parser"| node_parser
node_agent -->|"dispatches tools"| node_tools
node_agent -->|"requests tool calls"| node_gemini
node_gemini_client -->|"requests analysis"| node_gemini
node_web_user -->|"uses dashboard"| node_web_app
node_web_app -->|"uses backend"| node_web_parser
node_web_app -->|"uses backend"| node_groq_client
node_web_app -->|"uses backend"| node_web_agent
node_web_app -.->|"uses backend"| node_web_tools
node_web_cli -->|"invokes parsing"| node_web_parser
node_web_cli -->|"requests explanation"| node_groq_client
node_web_cli -->|"starts investigation"| node_web_agent
node_web_tools -->|"uses parser"| node_web_parser
node_web_agent -->|"dispatches tools"| node_web_tools
node_web_agent -->|"requests tool calls"| node_groq
node_groq_client -->|"requests analysis"| node_groq

click node_cli "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/cli.py"
click node_parser "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/parser.py"
click node_tools "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/tools.py"
click node_agent "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/agent.py"
click node_gemini_client "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/llm_client.py"
click node_web_app "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/app.py"
click node_web_cli "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/cli.py"
click node_web_parser "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/parser.py"
click node_web_tools "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/tools.py"
click node_web_agent "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/agent.py"
click node_groq_client "https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/llm_client.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_tools,node_agent,node_gemini_client,node_cli_user,node_web_user toneBlue
class node_web_parser,node_web_tools,node_web_agent,node_groq_client toneAmber
class node_cli,node_web_app,node_web_cli toneMint
class node_gemini,node_groq toneRose
class node_log_file toneIndigo
```

## Components

### CLI Backend

- [Anomaly Parser](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/parser.py): `Project/src/parser.py`
- [Investigation Tools](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/tools.py): `Project/src/tools.py`
- [Agent Loop](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/agent.py): `Project/src/agent.py`
- [Gemini Client](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/llm_client.py): `Project/src/llm_client.py`

### Web Backend

- [Web Anomaly Parser](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/parser.py): `WEB APP/Project/src/parser.py`
- [Web Investigation Tools](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/tools.py): `WEB APP/Project/src/tools.py`
- [Web Agent Loop](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/agent.py): `WEB APP/Project/src/agent.py`
- [Groq Client](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/llm_client.py): `WEB APP/Project/src/llm_client.py`

### User Interfaces

- [CLI Commands](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/Project/src/cli.py): `Project/src/cli.py`
- [Streamlit Dashboard](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/app.py): `WEB APP/Project/app.py`
- [Web CLI Commands](https://github.com/5406harish/log-file-anomaly-explainer-tool/blob/main/WEB%20APP/Project/src/cli.py): `WEB APP/Project/src/cli.py`

### External Services

- **Google Gemini**
- **Groq Cloud**

### Other components

- **CLI User**
- **Log File**
- **Dashboard User**

## Connections

- CLI User → CLI Commands: runs commands (evidence: `README.md`)
- CLI Commands → Anomaly Parser: invokes parsing (evidence: `Project/src/cli.py`)
- CLI Commands → Gemini Client: requests explanation (evidence: `Project/src/cli.py`)
- CLI Commands → Agent Loop: starts investigation (evidence: `Project/src/cli.py`)
- Anomaly Parser → Log File: reads (evidence: `Project/src/parser.py`)
- Investigation Tools → Anomaly Parser: uses parser (evidence: `Project/src/tools.py`)
- Agent Loop → Investigation Tools: dispatches tools (evidence: `Project/src/agent.py`)
- Agent Loop → Google Gemini: requests tool calls (evidence: `Project/src/agent.py`)
- Gemini Client → Google Gemini: requests analysis (evidence: `Project/src/llm_client.py`)
- Dashboard User → Streamlit Dashboard: uses dashboard (evidence: `WEB APP/Project/app.py`)
- Streamlit Dashboard → Web Anomaly Parser: uses backend (evidence: `WEB APP/Project/app.py`)
- Streamlit Dashboard → Groq Client: uses backend (evidence: `WEB APP/Project/app.py`)
- Streamlit Dashboard → Web Agent Loop: uses backend (evidence: `WEB APP/Project/app.py`)
- Streamlit Dashboard → Web Investigation Tools: uses backend
- Web CLI Commands → Web Anomaly Parser: invokes parsing (evidence: `WEB APP/Project/src/cli.py`)
- Web CLI Commands → Groq Client: requests explanation (evidence: `WEB APP/Project/src/cli.py`)
- Web CLI Commands → Web Agent Loop: starts investigation (evidence: `WEB APP/Project/src/cli.py`)
- Web Investigation Tools → Web Anomaly Parser: uses parser (evidence: `WEB APP/Project/src/tools.py`)
- Web Agent Loop → Web Investigation Tools: dispatches tools (evidence: `WEB APP/Project/src/agent.py`)
- Web Agent Loop → Groq Cloud: requests tool calls (evidence: `WEB APP/Project/src/agent.py`)
- Groq Client → Groq Cloud: requests analysis (evidence: `WEB APP/Project/src/llm_client.py`)
