Cloud › Logs and shell
Stream a deployment's logs
GET https://devapi.dispralabs.com/v1/cloud/deployments/:dep/logs/stream
Streams a deployment's build log (kind=build, the default) or its live output (kind=live), as Server-Sent Events. A build stream ends with event: end and the deployment's final state. Same lines, tail, gaps and resuming as the service stream.
Needs a key with read access or more.
- Authentication: Secret key (send it as
Authorization: Bearer <key>)
Parameters
depstring, required: The deployment's id. Example:dep_01jdk4p7q9w1e3r5t7y9u1i3obkindstring, optional: build or live (default build). Example:buildtailnumber, optional: Start with the newest N lines, 0 to 750.sincetimestamp, optional: Continue after this line's time.
Returns
- 200: A text/event-stream.
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_tail | tail is 0 to 750. |
| 404 | not_found | No such object in the key's project (or environment). |
Request samples
Dispra Cloud CLI
dcloud logs --build dep_01jdk4p7q9w1e3r5t7y9u1i3ob
cURL
curl "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build" \
-H "Authorization: Bearer dsp_live_YOUR_KEY"
Node
const res = await fetch("https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build", {
method: "GET",
headers: { Authorization: "Bearer dsp_live_YOUR_KEY" },
});
console.log(await res.json());
Python
import requests
res = requests.request("GET", "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream", headers={"Authorization": "Bearer dsp_live_YOUR_KEY"}, params={"kind": "build"})
print(res.json())
Go
req, _ := http.NewRequest("GET", "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build", nil)
req.Header.Set("Authorization", "Bearer dsp_live_YOUR_KEY")
res, _ := http.DefaultClient.Do(req)
Responses
200
{}
400 invalid_tail
{
"error": {
"code": "invalid_tail",
"message": "tail is 0 to 750.",
"request_id": "req_7f3a9c21d84be056"
}
}
404 not_found
{
"error": {
"code": "not_found",
"message": "No such object in the key's project (or environment).",
"request_id": "req_7f3a9c21d84be056"
}
}