Skip to main content
POST
/
get_workergroup_logs
/
get workergroup logs
curl --request POST \
  --url https://run.vast.ai/get_workergroup_logs/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": 12345,
  "tail": 1000
}
'
import requests

url = "https://run.vast.ai/get_workergroup_logs/"

payload = {
"id": 12345,
"tail": 1000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: 12345, tail: 1000})
};

fetch('https://run.vast.ai/get_workergroup_logs/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://run.vast.ai/get_workergroup_logs/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 12345,
'tail' => 1000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://run.vast.ai/get_workergroup_logs/"

payload := strings.NewReader("{\n \"id\": 12345,\n \"tail\": 1000\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://run.vast.ai/get_workergroup_logs/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 12345,\n \"tail\": 1000\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://run.vast.ai/get_workergroup_logs/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 12345,\n \"tail\": 1000\n}"

response = http.request(request)
puts response.read_body
{
  "logs": "2023-10-01 12:00:00 - Workergroup started\n2023-10-01 12:01:00 - Instance scaled up"
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
id
integer
default:12345
required

ID of the worker group

Required range: x >= 1
Example:

12345

tail
integer
default:10000

Number of log lines to retrieve from the end

Required range: x >= 1
Example:

1000

Response

200 - application/json

Logs successfully retrieved.

logs
string

The workergroup logs

Example:

"2023-10-01 12:00:00 - Workergroup started\n2023-10-01 12:01:00 - Instance scaled up"