API reference · Serverless
Recent container logs of the endpoint's workers
/v1/serverless/endpoints/{endpoint_id}/logs- TypeScript
client.serverless.getWorkerLogs()- Python
client.serverless.get_worker_logs()- CLI
hayonix serverless logs
The last tail lines of each live worker, or of one worker with worker_id. A worker whose logs cannot be read is listed in errors instead of failing the request.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the serverless_endpoint:read permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS "$API_BASE_URL/serverless/endpoints/sep_01jc5zq4m8k3v6x9t2w7r0b1e4/logs" \
-H "Authorization: Bearer $API_KEY"Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Path parameters
endpoint_idstringrequiredID of the endpoint
ID with prefix sep_
Query parameters
worker_idstringOne worker (default: every live worker)
ID with prefix swk_
tailintegerLines per worker (default 100)
1–1000
Response
200 ServerlessWorkerLogs — Log lines per worker
objectstringrequiredAlways `serverless_worker_logs`: the type of this object
One of
serverless_worker_logsdataarray of objectrequiredThe items
ShowHide 4 fields of
dataworker_idstringrequiredID of the worker
sourcestringrequiredWhere the text came from: `stdout` or `stderr` of the container, or `system` (a message from the platform about the container)
One of
stdoutstderrsystemstreamstringrequireddeprecatedDeprecated: read `source`, which carries the same information
textstringrequiredThe logged text, as written by the container
next_cursorany JSON | nullrequiredAlways null: the tail is one page
errorsarray of objectrequiredWorkers whose logs could not be read (for example not placed on a host yet), with the reason; the other workers are still returned
ShowHide 2 fields of
errorsworker_idstringrequiredID of the worker
messagestringrequiredOne sentence for people
Example response
{
"object": "serverless_worker_logs",
"data": [
{
"worker_id": "string",
"source": "stdout",
"stream": "string",
"text": "string"
}
],
"next_cursor": {},
"errors": [
{
"worker_id": "string",
"message": "string"
}
]
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |