Skip to content

Logs service

/logs ingests log lines from devices and lets owners search them. In the UI this powers the device Logs tab; on the CLI, pvr logs <device> reads from here.

Posting entries (devices)

Devices POST entries — single or as a batch array — authenticated as themselves. Mandatory fields are src (which log) and msg; recommended are tsec/tnano (timestamp) and lvl (severity). The device identity (dev) and time-created are filled in server-side.

sh
curl -s -X POST https://api.pantahub.com/logs/ \
  -H "Authorization: Bearer $DTOKEN" -H 'Content-Type: application/json' \
  -d '[
    {"src":"pantavisor.log","msg":"update applied","lvl":"INFO",
     "tsec":1496532292,"tnano":802110514},
    {"src":"myapp","msg":"started","lvl":"DEBUG",
     "tsec":1496532322,"tnano":802110545}
  ]'

Browsing (owners)

sh
curl -s "https://api.pantahub.com/logs/?start=0&page=50" \
  -H "Authorization: Bearer $TOKEN"

The response wraps entries with count, start and page. Filters and modifiers combine as query parameters:

ParameterMeaning
start, pageOffset paging: start offset and page size
after, beforeRFC3339 bounds on time-created (use one, not both)
sortSort key; prefix - for descending, e.g. sort=-time-created
src, dev, lvlRestrict by log source / device / level
cursor=trueAsk for a cursor for stable deep paging (below)

Sortable fields: tsec, tnano, device, src, lvl, time-created.

To follow logs, poll with after= set to the time-created of the last entry you saw.

Cursors

Offset paging degrades on long result sets; cursors don't. Pass cursor=true on the initial query, then feed each response's next-cursor to the cursor endpoint until it comes back empty:

sh
FIRST=$(curl -s "https://api.pantahub.com/logs/?cursor=true" \
  -H "Authorization: Bearer $TOKEN")
NEXT=$(echo "$FIRST" | jq -r '."next-cursor"')

curl -s -X POST https://api.pantahub.com/logs/cursor \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d "{\"next-cursor\":\"$NEXT\"}"

Each page returns a fresh next-cursor; an empty string means the cursor is exhausted (and invalidated).

Endpoint reference

Try any of these live in the API Reference:

EndpointReference
POST /logsPost entries
GET /logsQuery logs
GET /logs/cursorCursor paging