Skip to main content
Version: devel View Markdown

Logs API

Logs of job runs, read once a run has written them or followed live while it runs.

Base URL and authentication​

Each workspace keeps its data on the data plane of its region. Its services are not on api.dlthub.com and do not accept API keys. To call them:

  1. Read dataplane_url from GET https://api.dlthub.com/api/v1/workspaces/{workspace_id}. This is the base URL of every data plane service: Dataplane, Logs and Telemetry API.
  2. Exchange your API key for a data plane token with POST https://api.dlthub.com/api/v1/workspaces/{workspace_id}/-issue-dataplane-token. The token is valid for one workspace until expires_at, currently 10 minutes after it was issued; request a new one before then.
  3. Call the service at dataplane_url with Authorization: Bearer <token>.

Every workspace member can read logs, telemetry and file lists. Only workspace owners can read or change variables, so workspace API keys, which are DEVELOPER or VIEWER, cannot. Uploads use a separate token: POST .../deployments/-issue-upload (or /configurations/-issue-upload) returns an upload_token and the upload_url to send the files to, both valid for one upload and 10 minutes.

The data planes today:

Regiondataplane_url
Europe (eu1, europe-west4)https://eu1.dlthub.com
US East (us1, us-east4)https://us1.dlthub.com

Versioning​

The API version is part of the path. Endpoints under /v1 are stable: breaking changes ship only under a new version prefix. New endpoints, optional parameters and response fields can be added to /v1 at any time, so ignore fields and enum values you do not know.

Endpoints​

Stream workspace run logs​

GET /logs/v1/workspaces/{workspace_id}/job-runs/{job_run_id}/log-stream

Follows a job run's log as server-sent events (text/event-stream), starting from the beginning of the run. Each log event's data is one log line object as JSON. The stream ends when the run finishes. An error event with {"error": "..."} also ends it, for example Run unavailable when no run is found within about 60 seconds. Unknown run ids therefore return 200 followed by an error event, not 404.

Request

Path parameters

NameTypeDescription
workspace_idstring (uuid)ID of the workspace
job_run_idstring (uuid)ID of the job run
Response (200, 4xx, 5xx)

200 returns text/event-stream.

Get workspace run logs​

GET /logs/v1/workspaces/{workspace_id}/job-runs/{job_run_id}/logs

Returns a finished job run's stored log as newline-delimited JSON (application/x-ndjson), one log line object per line. Answers 404 while the run is still going, for a run that produced no output, and for an unknown run. To follow a running job, use log-stream.

Request

Path parameters

NameTypeDescription
workspace_idstring (uuid)ID of the workspace
job_run_idstring (uuid)ID of the job run
Response (200, 4xx, 5xx)

200 returns application/x-ndjson.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.