Send your plycdn activity to Logthread, step by step
Logthread is our observability product, billed on its own. Connect your plycdn organization to a Logthread workspace and plycdn sends it your storage request log, your video and live events, and your daily delivery totals. You then search them next to your applications' own logs, chart them, and get alerts. This page takes you from a Logthread key to your first search. The routes, fields and codes are in the reference: Integrations: Logthread.
You need: a Logthread workspace (Getting started), and either the dashboard or an admin API key (Developers → API keys, scope Admin). To do the same from your code, one of plycdn's server packages at 1.23.0 or later (ASP.NET Core, Node.js or Python).
1How it works
- You give plycdn an ingest key from your Logthread workspace. A key can only send data.
- You choose what to send: the storage request log, video and live events, and daily delivery totals.
- plycdn checks the key with Logthread, keeps it safely (it is never shown again, only its last four characters), and starts sending.
- In Logthread you search, chart and alert on it as you do on your own logs.
If you run a product for customers of your own, connect each sub-organization to its own Logthread workspace: see one workspace per customer.
2Create an ingest key in Logthread
In Logthread, open the workspace you want the data in, then Keys → Ingest keys → Create ingest key, and copy the key. Getting started shows each step.
3Connect
In the dashboard: Developers → Integrations, the Logthread card.
- When the Connect to Logthread button is shown, you can press it, choose a workspace on logthread.com and come back connected with everything on. Otherwise, or if you prefer, open Use an ingest key instead.
- Paste the key into Ingest key.
- Under What to send, switch on what you want: Storage requests, Video and live events and Daily delivery totals. At least one stays on.
- Press Connect. The card shows Connected, the key's last four characters and, under Last sent, when each kind of activity last arrived.
From your code:
PUT /api/content/v1/integrations/logthread
{"ingestKey": "YOUR_LOGTHREAD_INGEST_KEY", "signals": {"storage": true, "video": true, "delivery": false}}
Leave signals out to send everything. Send signals alone later to change what is sent and keep the key.
ASP.NET Core (inject PlycdnObservabilityApi from Plycdn.AspNetCore.Storage)
public async Task<LogthreadConnection> ConnectLogthreadAsync(PlycdnObservabilityApi observability, Guid orgId, string ingestKey)
{
await observability.ConnectLogthreadAsync(orgId, new LogthreadConnect
{
IngestKey = ingestKey,
Signals = new LogthreadSignalsUpdate { Delivery = false },
});
return await observability.GetLogthreadConnectionAsync(orgId);
}
Node.js
import { PlycdnStorageApi } from '@plycdn/node/storage';
import { PlycdnObservabilityApi } from '@plycdn/node/observability';
const observability = new PlycdnObservabilityApi(new PlycdnStorageApi({ apiKey: process.env.PLYCDN_ADMIN_KEY! }));
export async function connectLogthread(organizationId: string) {
await observability.connectLogthread(organizationId, {
ingestKey: process.env.LOGTHREAD_INGEST_KEY!,
signals: { delivery: false },
});
return observability.getLogthreadConnection(organizationId);
}
Python
import os
from plycdn.observability import PlycdnObservabilityApi
from plycdn.storage import PlycdnStorageApi
observability = PlycdnObservabilityApi(PlycdnStorageApi(os.environ["PLYCDN_ADMIN_KEY"]))
def connect_logthread(organization_id: str) -> dict:
observability.connect_logthread(organization_id, {
"ingestKey": os.environ["LOGTHREAD_INGEST_KEY"],
"signals": {"delivery": False},
})
return observability.get_logthread_connection(organization_id)
The browser packages (React, Angular) have nothing for this: it needs an admin key, which belongs on your server. Set it up from your server or in the dashboard.
4What arrives, and how to query it
Everything carries cloud.provider = plycdn, cloud.account.id (your organization id) and cloud.account.name.
| You switch on | In Logthread | What it holds |
|---|---|---|
| Storage requests | logs, service.name plycdn-storage |
One record per request: status, duration_ms, bytes_in, bytes_out, bucket, aborted and more. The object name is attr.key in queries, and the address the request came from is client.address. |
| Video and live events | logs, service.name plycdn-video |
The same events your webhooks receive: videos becoming ready or failing, live streams starting and ending. |
| Daily delivery totals | metrics, service.name plycdn-delivery |
The gauges plycdn.delivery.gb and plycdn.delivery.requests: one point per day at 00:00 UTC, with the day's settled figures. Quantities only. |
Examples in Logthread's query language:
service:plycdn-storage status>=500
service:plycdn-storage bucket:invoices duration_ms>2000
service:plycdn-video
Chart plycdn.delivery.gb on a dashboard to follow the data you deliver each day.
5Check it works
- In Developers → Integrations, the Logthread card shows Connected.
- Make a request to one of your buckets with an S3 or Azure tool and a storage credential, for example list or download one file (Check that requests reach plycdn shows how). Opening a file in the dashboard or through a delivery link is not a storage request. Under Last sent, Storage requests changes from Not yet to a time, usually within a minute. Reload the page to see it.
- In Logthread, search
service:plycdn-storageover the last hour. Your request is there. - Delivery totals arrive once a day, after the day has settled: look for the first point the next morning (UTC).
From your code, GetLogthreadConnectionAsync / getLogthreadConnection / get_logthread_connection returns status
(connected, paused, disconnected or not_connected), keyHint, signals, lastExport and lastError.
If nothing arrives, see Logthread's Nothing arrived?.
6What to expect
- Sending is best effort, with retries. Records older than 72 hours are dropped rather than sent late.
- If Logthread refuses the key, the card shows Disconnected. Paste a new key (Replace key).
- If your Logthread workspace reaches its daily quota, the card shows Paused and sending resumes on its own. The limits are in Logthread's limits and response codes; what Logthread keeps and for whom is in its data protection notes.
7Disconnect
In the dashboard: Developers → Integrations → Disconnect, then confirm. plycdn forgets the key and sends nothing more.
From your code: DELETE /api/content/v1/integrations/logthread. Disconnecting twice changes nothing.
await observability.DisconnectLogthreadAsync(orgId);
await observability.disconnectLogthread(organizationId);
observability.disconnect_logthread(organization_id)
If you connected with Connect to Logthread, plycdn also withdraws the key it was given. If you pasted an ingest key, delete it in Logthread as well if you no longer need it.
8Questions and problems
422 logthread_key_rejected. Logthread did not accept the key. Create a current one in Logthread (Keys → Ingest
keys) in the workspace you want, and connect again.
503 logthread_unreachable. Logthread could not be reached just now, or its workspace is suspended or not ready yet.
Try again in a minute.
422 logthread_connect_failed. Connect to Logthread took more than 10 minutes, was already used, or was refused.
Press Connect to Logthread again.
422 validation_error, "ingestKey is required". The first connection needs a key. Send ingestKey.
403 admin_key_required. These calls need an admin key. Keep it on your server.
403 dashboard_session_required. The one-click Connect steps are for a person signed in to the dashboard. With a key,
connect with an ingest key.
The card says Disconnected. Logthread refused the key, usually because it was deleted. Paste a new one.
Nothing in Logthread. Check that the signal is switched on, that the card does not say Paused or Disconnected, and that you searched the right workspace and time range. Delivery shows once a day.
Every code: Errors.