Logging: Logs werden jetzt im logs/ Unterverzeichnis gespeichert
This commit is contained in:
75
LOGGING.md
Normal file
75
LOGGING.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Logging-System
|
||||
|
||||
Das Wordle-Helper Logging-System protokolliert Seitenaufrufe und Suchanfragen ohne personenbezogene Daten wie IP-Adressen.
|
||||
|
||||
## Log-Datei
|
||||
|
||||
- **Verzeichnis:** `logs/`
|
||||
- **Datei:** `logs/app.log`
|
||||
- **Format:** UTF-8
|
||||
- **Rotation:** Keine automatische Rotation (manuell oder über externe Tools)
|
||||
- **Verzeichnis:** Wird automatisch erstellt, falls es nicht existiert
|
||||
|
||||
## Protokollierte Ereignisse
|
||||
|
||||
### 1. Seitenaufrufe (PAGE_VIEW)
|
||||
|
||||
```
|
||||
2024-01-01 12:00:00 - INFO - PAGE_VIEW: index | User-Agent: Mozilla/5.0...
|
||||
2024-01-01 12:00:01 - INFO - PAGE_VIEW: manifest | User-Agent: Mozilla/5.0...
|
||||
2024-01-01 12:00:02 - INFO - PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0...
|
||||
```
|
||||
|
||||
### 2. Suchanfragen (SEARCH)
|
||||
|
||||
```
|
||||
2024-01-01 12:00:05 - INFO - SEARCH: pos='hallo' includes='' excludes='' sources=['OT'] | User-Agent: Mozilla/5.0...
|
||||
2024-01-01 12:00:10 - INFO - SEARCH: pos='' includes='aei' excludes='rst' sources=['OT', 'WF'] | User-Agent: Mozilla/5.0...
|
||||
```
|
||||
|
||||
## Log-Format
|
||||
|
||||
- **Zeitstempel:** ISO-Format (YYYY-MM-DD HH:MM:SS)
|
||||
- **Ereignistyp:** PAGE_VIEW oder SEARCH
|
||||
- **Details:** Spezifische Informationen je nach Ereignistyp
|
||||
- **User-Agent:** Gekürzt auf 100 Zeichen (ohne IP-Adressen)
|
||||
|
||||
## Datenschutz
|
||||
|
||||
- **Keine IP-Adressen** werden protokolliert
|
||||
- **Keine persönlichen Daten** werden gespeichert
|
||||
- **User-Agent** wird gekürzt und anonymisiert
|
||||
- **Logs** werden nicht ins Git-Repository übertragen (`.gitignore`)
|
||||
|
||||
## Konfiguration
|
||||
|
||||
Das Logging ist in `app.py` konfiguriert:
|
||||
|
||||
```python
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler('app.log', encoding='utf-8'),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
## Log-Analyse
|
||||
|
||||
Die Log-Datei kann mit Standard-Tools analysiert werden:
|
||||
|
||||
```bash
|
||||
# Alle Suchanfragen anzeigen
|
||||
grep "SEARCH:" logs/app.log
|
||||
|
||||
# Seitenaufrufe zählen
|
||||
grep "PAGE_VIEW:" logs/app.log | wc -l
|
||||
|
||||
# Häufigste Suchparameter
|
||||
grep "SEARCH:" logs/app.log | cut -d'|' -f1
|
||||
|
||||
# Logs-Verzeichnis anzeigen
|
||||
ls -la logs/
|
||||
```
|
Reference in New Issue
Block a user