Trajanje: ~10 minuta
Uloga: Gateway-Operator
Ucestalost: Dnevno / Kod problema
Analiza Gateway logova za dijagnozu gresaka i monitoring.
| Platforma | Put |
| ———– | —— |
| Windows (Konzola) | Konzolni izlaz |
| Windows (Service) | %GATEWAY_ROOT%\logs\ ili Event Log |
| Linux (systemd) | journalctl -u data-gateway |
| Docker | docker logs gateway |
Windows (Datoteka):
# Zadnjih 50 linija 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):
# Zadnjih 100 linija journalctl -u data-gateway -n 100 --no-pager # Live-Tail journalctl -u data-gateway -f
Docker:
# Zadnjih 100 linija docker logs --tail 100 gateway # Live-Tail docker logs -f gateway
Windows:
# ERROR unosi Select-String -Path "%GATEWAY_ROOT%\logs\*.log" -Pattern "ERROR|Exception" # Danas Get-Content "%GATEWAY_ROOT%\logs\gateway.log" | Where-Object { $_ -match "ERROR" -and $_ -match (Get-Date -Format "yyyy-MM-dd") }
Linux:
# ERROR unosi journalctl -u data-gateway --since today | grep -E "ERROR|Exception" # Ili u datoteci grep -E "ERROR|Exception" /var/log/gateway/gateway.log
Uspjesan zahtjev:
[INFO] GET /api/v1/dsn/demo/tables 200 45ms
Greska:
[ERROR] GET /api/v1/dsn/invalid/tables 404 Database 'invalid' not found [ERROR] POST /api/v1/dsn/demo/query 500 SqlException: Invalid syntax
Upozorenje:
[WARN] Slow query detected: 2340ms for GET /api/v1/dsn/produktion/tables/BigTable
U appsettings.json:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "WvdS.WebAPI.Data.Gateway": "Debug" } } }
| Level | Upotreba |
| ——- | ———— |
Trace | Vrlo detaljno (Razvoj) |
Debug | Debugging informacije |
Information | Normalne operacije (Standard) |
Warning | Potencijalni problemi |
Error | Greske koje su obradene |
Critical | Teske greske, pad |
| # | Provjera | Da/Ne |
| — | ———– | — |
| 1 | ERROR unosi pregledani | - |
| 2 | WARN unosi pregledani | - |
| 3 | Slow Queries zabilježeni | - |
| 4 | Greske dokumentirane/prijavljene | - |
| 5 | Log-Rotation aktivna | - |
| Log poruka | Uzrok | Rjesenje |
| ————- | ——— | ——– |
Database not found | DSN nije konfigurirana | appsettings.json provjeriti |
Connection refused | DB nije dostupna | Firewall/Mrezu provjeriti |
SqlException: Login failed | Pogresni Credentiali | Lozinku provjeriti |
OutOfMemoryException | Preveliki upit | $top Limit postaviti |
Timeout expired | DB prespora | Index optimizirati |
Serilog (appsettings.json):
{ "Serilog": { "WriteTo": [ { "Name": "File", "Args": { "path": "logs/gateway-.log", "rollingInterval": "Day", "retainedFileCountLimit": 30 } } ] } }
« <- Health Check | -> Operator pregled »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional