Skip to main content

Logs & Diagnostics

Log Locations​

SourceLocation
Application logsstdout/stderr (captured by PM2 or Docker)
PM2 logs~/.pm2/logs/zs-iot-*.log
SQLite logsStored in the database logs table
Device logsPer-device communication logs in the database

Viewing Logs​

# PM2 logs
pm2 logs zs-iot

# Follow logs in real-time
pm2 logs zs-iot --lines 100

# View device-specific logs via API
curl http://localhost:3000/api/logs?device_id=ada-xxxxx

Common Log Patterns​

PatternMeaning
[PING] Device ada-xxx OK (120ms)Healthy device response
[PING] Device ada-xxx FAILED (timeout)Device unreachable
[ACTION] unlock ada-xxx SUCCESSDevice action completed
[WEBHOOK] booking.start receivedBooking event received
[TAILSCALE] Connected to networkVPN connection established

Diagnostics​

Check System Health​

curl http://localhost:3000/api/health

Check Individual Device​

curl http://localhost:3000/api/devices/ada-xxxxx/status

Test Device Connection​

curl -X POST http://localhost:3000/api/devices/ada-xxxxx/ping

Next Steps​