Durata: ~10 minuti
Ruolo: Operatore Gateway
Frequenza: Giornaliera / In caso di problemi
Analisi dei log del Gateway per diagnosi errori e monitoraggio.
| Piattaforma | Percorso |
| ———– | —— |
| Windows (Console) | Output console |
| Windows (Service) | %GATEWAY_ROOT%\logs\ o Event Log |
| Linux (systemd) | journalctl -u data-gateway |
| Docker | docker logs gateway |
Windows (File):
# Ultime 50 righe Get-Content -Path "%GATEWAY_ROOT%\logs\gateway.log" -Tail 50 # Live-Tail Get-Content -Path "%GATEWAY_ROOT%\logs\gateway.log" -Wait -Tail 10
Linux (systemd):
# Ultime 100 righe journalctl -u data-gateway -n 100 --no-pager # Live-Tail journalctl -u data-gateway -f
Docker:
# Ultime 100 righe docker logs --tail 100 gateway # Live-Tail docker logs -f gateway
Windows:
# Voci ERROR Select-String -Path "%GATEWAY_ROOT%\logs\*.log" -Pattern "ERROR|Exception" # Oggi Get-Content "%GATEWAY_ROOT%\logs\gateway.log" | Where-Object { $_ -match "ERROR" -and $_ -match (Get-Date -Format "yyyy-MM-dd") }
Linux:
# Voci ERROR journalctl -u data-gateway --since today | grep -E "ERROR|Exception" # Oppure in file grep -E "ERROR|Exception" /var/log/gateway/gateway.log
Richiesta riuscita:
[INFO] GET /api/v1/dsn/demo/tables 200 45ms
Errore:
[ERROR] GET /api/v1/dsn/invalid/tables 404 Database 'invalid' not found [ERROR] POST /api/v1/dsn/demo/query 500 SqlException: Invalid syntax
Avviso:
[WARN] Slow query detected: 2340ms for GET /api/v1/dsn/produzione/tables/BigTable
In appsettings.json:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "WvdS.WebAPI.Data.Gateway": "Debug" } } }
| Livello | Utilizzo |
| ——- | ———— |
Trace | Molto dettagliato (Sviluppo) |
Debug | Informazioni di debug |
Information | Operazioni normali (Standard) |
Warning | Problemi potenziali |
Error | Errori gestiti |
Critical | Errori gravi, crash |
| # | Punto di verifica | v |
| — | ———– | — |
| 1 | Voci ERROR esaminate | ☐ |
| 2 | Voci WARN esaminate | ☐ |
| 3 | Query lente annotate | ☐ |
| 4 | Errori documentati/segnalati | ☐ |
| 5 | Rotazione log attiva | ☐ |
| Messaggio Log | Causa | Soluzione |
| ————- | ——— | ——– |
Database not found | DSN non configurato | Verificare appsettings.json |
Connection refused | DB non raggiungibile | Verificare firewall/rete |
SqlException: Login failed | Credenziali errate | Verificare password |
OutOfMemoryException | Query troppo grande | Impostare limite $top |
Timeout expired | DB troppo lento | Ottimizzare indici |
Serilog (appsettings.json):
{ "Serilog": { "WriteTo": [ { "Name": "File", "Args": { "path": "logs/gateway-.log", "rollingInterval": "Day", "retainedFileCountLimit": 30 } } ] } }
« <- Health Check | -> Panoramica Operatore »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional