Add Vue 3 dashboard frontend with nginx reverse proxy, charts and LLM analysis UI

This commit is contained in:
Arch Agent
2026-05-07 10:19:36 +02:00
parent 695d715d5b
commit 7d9bad9ead
7 changed files with 478 additions and 25 deletions
+28 -17
View File
@@ -1,21 +1,22 @@
# Log Analyzer Backend
# Log Analyzer Backend + Frontend
CPU-LLM-gestütztes Backend zur Auswertung von Firewall- und Proxy-Logs. Parst Dateien, aggregiert Statistiken (Top-Hits, Quellen, Ziele, Ports, URLs) und nutzt ein lokales LLM (via Ollama) für die Analyse.
CPU-LLM-gestütztes Dashboard zur Auswertung von Firewall- und Proxy-Logs. Parst Dateien, zeigt übersichtliche Statistiken (Top-Hits, Quellen, Ziele, Ports, URLs, Zeitverlauf) und nutzt ein lokales LLM (via Ollama) für die Analyse.
## Features
- **Log-Parsing:** Unterstützt iptables, pfSense, Cisco ASA, Squid, nginx
- **Statistiken:** Top Quellen, Ziele, Ports, URLs, Actions, Timeline
- **LLM-Analyse:** Zusammenfassung und Anomalie-Erkennung via lokalem Ollama-Modell
- **REST-API:** FastAPI mit automatischer OpenAPI-Doku unter `/docs`
- **Docker-Compose:** Schneller Start mit Backend + nginx Reverse Proxy
- **Web-Dashboard:** Vue 3 + Chart.js SPA, erreichbar auf Port 80
- **Docker-Compose:** Ein Befehl zum Starten von Backend + Frontend
## Architektur
```
┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐
Client │──────▶│ nginx:80 │──────▶│ FastAPI Backend:8000 │
└──────────────┘ └──────────────┘ │ - SQLite (Volumen) │
│ - Log-Parser │
│ - Ollama-Client │
Browser │──────▶│ Frontend:80 │──────▶│ FastAPI Backend:8000 │
└──────────────┘ │ (nginx + │ │ - SQLite (Volumen) │
│ Vue SPA) │ - Log-Parser │
└──────────────┘ │ - Ollama-Client │
└───────────────────────┘
@@ -29,7 +30,7 @@ CPU-LLM-gestütztes Backend zur Auswertung von Firewall- und Proxy-Logs. Parst D
## Voraussetzungen
- Docker + Docker Compose
- Laufende Ollama-Instanz auf dem Host (Port 11434) mit Modell `llava:7b`
- Ports: 8080 (nginx), 11434 (Ollama auf Host)
- Ports: 80 (Dashboard), 11434 (Ollama auf Host)
## Installation & Start
@@ -42,30 +43,38 @@ cd log-analyzer-backend
docker-compose up -d --build
```
Die API ist dann unter `http://localhost:8080/api` erreichbar.
Das Dashboard ist dann unter `http://localhost` erreichbar. Die API-Doku unter `http://localhost/docs`.
## Nutzung
### Log-Datei hochladen
### Dashboard
1. Browser öffnen: `http://localhost`
2. Log-Datei über das Upload-Feld hochladen
3. Statistiken und Charts werden automatisch geladen (alle 15 Sek. refreshed)
4. LLM-Analyse über den Bereich unten starten
### API (cURL)
#### Log-Datei hochladen
```bash
curl -X POST http://localhost:8080/api/upload \
curl -X POST http://localhost/api/upload \
-H "Content-Type: multipart/form-data" \
-F "file=@/var/log/iptables.log"
```
### Statistiken abrufen
#### Statistiken abrufen
```bash
curl "http://localhost:8080/api/stats?limit=20"
curl "http://localhost/api/stats?limit=20"
```
### LLM-Analyse starten
#### LLM-Analyse starten
```bash
curl -X POST "http://localhost:8080/api/analyze?log_type=firewall&limit=100"
curl -X POST "http://localhost/api/analyze?log_type=firewall&limit=100"
```
### Gesundheitscheck
#### Gesundheitscheck
```bash
curl http://localhost:8080/health
curl http://localhost/health
```
## API-Endpunkte
@@ -79,6 +88,7 @@ curl http://localhost:8080/health
| GET | `/api/stats/ports` | Top Ports |
| POST | `/api/analyze` | LLM-Analyse der Logs |
| GET | `/health` | Healthcheck |
| GET | `/docs` | Swagger UI (FastAPI) |
## Umgebungsvariablen
@@ -103,6 +113,7 @@ curl http://localhost:8080/health
- Das Backend erwartet Ollama auf dem **Host** (nicht im Container). Für Linux ggf. `extra_hosts: ["host.docker.internal:host-gateway"]` nutzen.
- Große Logdateien werden in Batches von 500 Zeilen verarbeitet.
- Die SQLite-Datenbank wird im Docker-Volumen `logdata` persistiert.
- Das Frontend aktualisiert die Statistiken automatisch alle 15 Sekunden.
## Lizenz
MIT