Skip to main content
PUT
/
api
/
v0
/
instances
/
request_logs
/
{id}
show logs
curl --request PUT \
  --url https://console.vast.ai/api/v0/instances/request_logs/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tail": "1000",
  "filter": "<string>",
  "daemon_logs": "true"
}
'
import requests

url = "https://console.vast.ai/api/v0/instances/request_logs/{id}"

payload = {
"tail": "1000",
"filter": "<string>",
"daemon_logs": "true"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

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

fetch('https://console.vast.ai/api/v0/instances/request_logs/{id}', 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://console.vast.ai/api/v0/instances/request_logs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'tail' => '1000',
'filter' => '<string>',
'daemon_logs' => 'true'
]),
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://console.vast.ai/api/v0/instances/request_logs/{id}"

payload := strings.NewReader("{\n \"tail\": \"1000\",\n \"filter\": \"<string>\",\n \"daemon_logs\": \"true\"\n}")

req, _ := http.NewRequest("PUT", 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.put("https://console.vast.ai/api/v0/instances/request_logs/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tail\": \"1000\",\n \"filter\": \"<string>\",\n \"daemon_logs\": \"true\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://console.vast.ai/api/v0/instances/request_logs/{id}")

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

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

response = http.request(request)
puts response.read_body
{
  "success": true,
  "result_url": "https://s3.amazonaws.com/vast.ai/instance_logs/{hash}.log",
  "msg": "<string>"
}
{
"error": "not_authorized",
"msg": "Not authorized to view logs for this instance"
}
{
"error": "invalid_id",
"msg": "Invalid instance id."
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Path Parameters

id
integer
required

ID of the instance to get logs from

Body

application/json
tail
string

Number of lines to show from end of logs

Example:

"1000"

filter
string

Grep filter to apply to log entries

daemon_logs
enum<string>

If "true", fetch daemon system logs instead of container logs

Available options:
true

Response

Success response with S3 URL for log retrieval

success
boolean
Example:

true

result_url
string

S3 URL where logs can be downloaded

Example:

"https://s3.amazonaws.com/vast.ai/instance_logs/{hash}.log"

msg
string

Status message