# safaebiz/log-analysis-tool architecture

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

- Interactive diagram: https://gitdiagram.com/safaebiz/log-analysis-tool
- Repository: https://github.com/safaebiz/log-analysis-tool

## Overview

This is a command-line defensive log analyzer. An analyst supplies an auth or web access log; the CLI selects its type, parsing converts lines into structured events, and detection applies signature and behavioral rules before severity ranking. The CLI can filter findings and send a formatted report to the console or an optional file. The README documents the supported attack categories; the graph separates auth and web detection stages, though both are implemented in the same detector module. Only sampled source relationships are shown.

Main entry points: [`loganalyzer/cli.py`](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/cli.py) (CLI workflow), [`loganalyzer/rules.py`](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/rules.py) (Detection rules), [`loganalyzer/detector.py`](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/detector.py) (Auth detection), [`loganalyzer/parsers.py`](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/parsers.py) (Log parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Input &amp; orchestration"]
  node_cli["CLI workflow<br/>[cli.py]"]
  node_parsing["Log parsing<br/>[parsers.py]"]
end

subgraph group_analysis["Threat analysis"]
  node_auth_detection["Auth detection<br/>[detector.py]"]
  node_web_detection["Web detection<br/>[detector.py]"]
  node_rules["Detection rules<br/>[rules.py]"]
end

subgraph group_reporting["Reporting"]
  node_report["Report formatting<br/>[report.py]"]
  node_report_file["Report file"]
end

node_analyst(("Analyst"))

node_analyst -->|"runs analysis"| node_cli
node_cli -->|"parses log"| node_parsing
node_cli -->|"analyzes auth"| node_auth_detection
node_cli -->|"analyzes access"| node_web_detection
node_auth_detection -->|"uses thresholds"| node_rules
node_web_detection -->|"matches signatures"| node_rules
node_cli -->|"filters severity"| node_rules
node_cli -->|"renders findings"| node_report
node_cli -->|"prints report"| node_analyst
node_cli -->|"writes report"| node_report_file

click node_cli "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/cli.py"
click node_parsing "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/parsers.py"
click node_auth_detection "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/detector.py"
click node_web_detection "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/detector.py"
click node_rules "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/rules.py"
click node_report "https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/report.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_cli,node_parsing toneBlue
class node_auth_detection,node_web_detection,node_rules toneAmber
class node_report,node_report_file toneMint
class node_analyst toneIndigo
```

## Components

### Input & orchestration

- [CLI workflow](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/cli.py): `loganalyzer/cli.py`
- [Log parsing](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/parsers.py): `loganalyzer/parsers.py`

### Threat analysis

- [Auth detection](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/detector.py): `loganalyzer/detector.py`
- [Web detection](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/detector.py): `loganalyzer/detector.py`
- [Detection rules](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/rules.py): `loganalyzer/rules.py`

### Reporting

- [Report formatting](https://github.com/safaebiz/log-analysis-tool/blob/main/loganalyzer/report.py): `loganalyzer/report.py`
- **Report file**

### Other components

- **Analyst**

## Connections

- Analyst → CLI workflow: runs analysis (evidence: `README.md`)
- CLI workflow → Log parsing: parses log (evidence: `loganalyzer/cli.py`)
- CLI workflow → Auth detection: analyzes auth (evidence: `loganalyzer/cli.py`)
- CLI workflow → Web detection: analyzes access (evidence: `loganalyzer/cli.py`)
- Auth detection → Detection rules: uses thresholds (evidence: `loganalyzer/detector.py`)
- Web detection → Detection rules: matches signatures (evidence: `loganalyzer/detector.py`)
- CLI workflow → Detection rules: filters severity (evidence: `loganalyzer/cli.py`)
- CLI workflow → Report formatting: renders findings (evidence: `loganalyzer/cli.py`)
- CLI workflow → Analyst: prints report (evidence: `loganalyzer/cli.py`)
- CLI workflow → Report file: writes report (evidence: `loganalyzer/cli.py`)
