2.0 KiB
2.0 KiB
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:
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:
# 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/