Live log
Read every frame, event, capture and stream status your deployments and workflows log, live or as history, from the cloud, a browser or an iPhone.
On this page
Everything a deployment or a workflow runs is logged: each frame’s annotations, each event a workflow fires, each image a stream captures, each stream’s numbers every second and its state. Read it live, as it is logged, or as history, by name, from every session and every device (a GPU in the cloud, or the browser or iPhone that ran it), filtered at the server.
from pictograph import Client
client = Client()
records = client.deployments.logs(
deployment="loading-dock",
live=True,
)
for record in records:
print(record.time, record.kind, [a.name for a in record.annotations])
pictograph deployments logs loading-dock --live
Live connections
live=True (--live, -f or --follow in the CLI) opens a live connection: each record
arrives within a second or two of being logged, for as long as you loop. With since it reads
the history from then first, then turns live, each record once.
records = client.workflows.logs(
workflow="crosswalk",
live=True,
kinds=["event"],
since="10m",
)
for record in records:
print(record.time, record.event.name, record.event.text) # the last 10 minutes, then live
pictograph workflows logs crosswalk --live --kind event --since 10m --json
The server ends a connection every two minutes and the SDK and CLI open it again exactly where it stood, as they do when the network drops it: nothing is lost or seen twice, and your loop never sees it. Each open connection counts toward your plan’s live connections until it closes.
Gaps
A gap record stands in for records a connection could not carry (it fell further behind than
the live window holds, or a batch never reached it). Read them from the history with its
gap.backfill as cursor, up to its time. That read can hold records the connection did
carry, so keep each once by its identity:
seen = set()
records = client.deployments.logs(
deployment="loading-dock",
live=True,
)
for record in records:
if record.kind == "gap":
missed = client.deployments.logs(
deployment="loading-dock",
cursor=record.gap.backfill,
until=record.time,
)
for earlier in missed:
if earlier.identity not in seen:
print("caught up", earlier.time, earlier.kind)
continue
seen.add(record.identity)
pictograph deployments logs loading-dock --cursor "$BACKFILL" --until "$GAP_TIME" --json
History
Without live, the log reads oldest first over a window, page by page as you loop; you never
handle a page.
records = client.deployments.logs(
deployment="loading-dock",
since="1h",
)
for record in records:
print(record.time, record.session, [a.name for a in record.annotations])
pictograph deployments logs loading-dock --since 1h
Filters
The server applies them, live or not, so what they leave out is never sent.
| Python | CLI | REST | Keeps |
|---|---|---|---|
since, until |
--since, --until |
since, until |
The records in this window: now, a duration ago (30s, 10m, 1h30m, 2d) or an ISO 8601 time. Default: the last hour. A live connection has no until |
kinds |
--kind |
kinds |
These kinds: frame, event, capture, stats, status |
classes |
--class |
classes |
Records with an annotation of these classes, each carrying those alone |
min_confidence |
--min-confidence |
min_confidence |
Annotations at least this confident (0 to 1) |
session |
--session |
session |
One stream (its id), or one workflow run (its id) |
every |
--every |
every |
Every Nth frame of each stream |
cursor |
--cursor |
cursor |
The records after a record’s cursor, or from a gap’s backfill |
records = client.deployments.logs(
deployment="loading-dock",
live=True,
kinds=["frame"],
classes=["forklift"],
min_confidence=0.6,
every=10,
)
Sessions and devices
Each stream from a browser or an iPhone says how it is going with status records, one a
change: running while its frames come, paused while it runs and its camera sends nothing,
stalled after 30 seconds of silence, ended with how (reason: its runner’s words, or
lost after 10 minutes of nothing). Every record’s source.device names what ran it: cloud,
ios or browser, set by Pictograph from the session it opened.
records = client.deployments.logs(
deployment="loading-dock",
live=True,
kinds=["status"],
)
for record in records:
print(record.session, record.source.device, record.status.state, record.status.reason)
An edge deployment’s Overview in the app lists its sessions the same way.
Captures
A capture record is an image a stream captured (on an event, or by
Passive capture). download saves it from its signed
URL, which works for 15 minutes after the page or connection that carried it.
records = client.deployments.logs(
deployment="loading-dock",
kinds=["capture"],
since="1d",
)
for record in records:
record.capture.download("captures/")
pictograph deployments logs loading-dock --kind capture --since 1d --download captures/
JSON Lines
--json prints every record as one line of JSON, as it is read or arrives, for jq and
scripts. Without it the CLI prints a table (of the first 100 records of the history; --limit
changes it, 0 prints every one).
pictograph deployments logs loading-dock --live --json | jq -r '.annotations[].name'
pictograph workflows logs crosswalk --kind event --json | jq -c '{time, event: .event.name}'
The record
Every kind is one shape; a field another kind carries is null.
| Field | What it is |
|---|---|
cursor |
Where a read resumes after it. A live record’s also says where it arrived, so compare records by identity (the SDK’s), the same on every read and in a webhook |
kind |
frame, event, capture, stats, status, or gap on a live connection |
time |
When its frame was captured, on the camera’s or sender’s clock, else when it was answered |
deployment, workflow |
Whose log it is |
session |
The stream’s id, or the workflow run’s; null for a single prediction |
source |
device (cloud, ios, browser, or edge for a device the session did not name), kind (stream, or a workflow stream’s rtsp, whip, whep; image, video, dataset, export) and name |
model |
name, task, version, precision |
frame |
number, width, height, media_time (seconds into its stream or video), latency_ms |
annotations |
The frame’s annotations as Pictograph JSON, the class under name; the SDK’s annotation types in Python |
tags |
A classifier’s labels, each name and confidence |
event |
An event’s name (as the app shows it), kind, trigger, values, text (its values in words) and captured |
capture |
file, url, trigger, event; where it was saved (dataset, directory, image) in a capture.saved webhook |
stats |
A stream’s fps, frames, inferred, detections, events, media_time, latency_ms percentiles and measures, each second |
status |
state (running, paused, stalled, ended) and reason |
gap |
missed (how many, when known) and backfill (the cursor to read them from) |
In Python each record is a LogRecord.
Webhooks
deployment.frames pushes a deployment’s frames as they are logged, about one delivery a second
for each stream; capture.saved pushes an image a stream captured once it is saved into its
dataset; session.status pushes each change of a stream’s state. Each carries these records,
under the endpoint’s filters.
client.webhooks.create(
url="https://example.com/hooks/dock",
event_types=["deployment.frames", "capture.saved", "session.status"],
filters={"deployments": ["loading-dock"], "classes": ["forklift"]},
)
pictograph webhooks create https://example.com/hooks/dock -e deployment.frames -e session.status \
--filters '{"deployments": ["loading-dock"], "classes": ["forklift"]}'
An endpoint receives them only when it names them. Payloads, filters and signatures: Live log events.
REST
GET /api/v1/developer/deployments/{deployment}/logs and
GET /api/v1/developer/workflows/{workflow}/logs take the filters above (kinds and classes
repeated, or comma-separated), limit (100, at most 1000) and cursor. A page answers
records, next_cursor (null on the last page), the window it read as since and until,
and frames_logged.
curl -s "https://api.pictograph.io/api/v1/developer/deployments/loading-dock/logs?since=1h&kinds=frame&kinds=capture" \
-H "X-API-Key: $PICTOGRAPH_API_KEY"
For the next page, send the same query with cursor set to next_cursor, and since and
until set to the times the first page answered, so a relative window does not move.
With live=true the answer is a stream of Server-Sent Events: each record as id: (its
cursor), event: (its kind) and data: (the record as JSON); an id: alone where the
connection stands; a : keepalive comment every 15 seconds of quiet; and : reconnect when
the server ends it. Open it again with Last-Event-ID set to the last id, and the same
X-Pictograph-Live-Connection header each time (any 32 hex characters you choose), so it counts
once. Accept-Encoding: gzip compresses it.
curl -sN "https://api.pictograph.io/api/v1/developer/deployments/loading-dock/logs?live=true&kinds=event" \
-H "X-API-Key: $PICTOGRAPH_API_KEY" \
-H "X-Pictograph-Live-Connection: 3f2a9c1e5b7d4a6f8e0c2b4d6f8a0c1e"
Errors: Live log errors.
Plans and usage
| Plan | Logged | Live connections at once | Live log a month |
|---|---|---|---|
| Free | Events, captures, stats and statuses | 1 | No cost |
| Core | Every kind, frames included | 3 | 5 GB |
| Pro | Every kind | 10 | 25 GB |
| Team | Every kind | 25 | 100 GB |
| Enterprise | Every kind | By contract | By contract |
A month’s Live log is what its live connections and Live log webhooks deliver, compressed. Each GB past the plan’s is charged to your compute credits (the included allowance first, then pay-as-you-go up to your Budget). Settings > Usage shows the month so far and the connections open now.
| Refused | Why, and the one thing to do |
|---|---|
403 live_connection_limit |
Every live connection your plan allows is open (one closed in the last three minutes can still count). Close one, or upgrade |
403 frames_not_logged |
kinds names frame on a plan that logs no frames. Read the other kinds, or upgrade |
402 insufficient_credits |
This month’s Live log is past your plan’s and your Budget. Raise the Budget in Settings > Usage |
Events, captures, stats and statuses are kept 13 months; frames 30 days.