> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> Learn how to fetch and analyze logs from Vast.ai Serverless endpoints and worker groups. Understand the log levels, how to use cURL to fetch logs, and how to interpret the logs for debugging and performance monitoring.

<script
  type="application/ld+json"
  dangerouslySetInnerHTML={{
__html: JSON.stringify({
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "headline": "Vast.ai Serverless Logs",
  "description": "API reference for fetching and analyzing logs from Vast.ai Serverless endpoints and worker groups using /get_endpoint_logs/ and /get_autogroup_logs/ endpoints, including log levels (debug, trace, info0, info1).",
  "author": {
    "@type": "Organization",
    "name": "Vast.ai"
  },
  "articleSection": "Serverless Documentation",
  "keywords": ["logs", "debugging", "endpoints", "worker groups", "serverless", "vast.ai", "monitoring"]
})
}}
/>

Both Endpoints and Worker Groups keep logs that can be fetched by using the `/get_endpoint_logs/` and `/get_autogroup_logs/` endpoints, respectively.

Endpoint logs relate to managing instances, and Worker Group logs relate to searching for offers to create instances from, as well as calls to create instances using the offers.&#x20;

For both types of groups, there are four levels of logs with decreasing levels of detail: **debug**, **trace**, **info0**, and **info1**.

<Warning>
  Each log level has a fixed size, and once it is full, the log is wiped and overwritten with new log messages. It is good practice to check these regularly while debugging.
</Warning>

# Using the CLI

You can use the vastai CLI to quickly check endpoint and worker group logs at different log levels.

## Endpoint logs

```cli CLI Command theme={null}
vastai get endpt-logs <endpoint_id> --level (0-3)
```

## Workergroup logs

```cli CLI Command theme={null}
vastai get wrkgrp-logs <worker_group_id> --level (0-3)
```

# POST [https://run.vast.ai/get\_endpoint\_logs/](https://run.vast.ai/get_endpoint_logs/)

## Inputs

* One of the following:
  * `id`(int): ID of your endpoint
  * `endpoint`(string): Name of your endpoint
* `api_key`(string): The Vast API key associated with the account that controls the Endpoint.
* `tail` (int): The number of bytes from the end of each log file that will be sent in the response.
  * If the file size is less than or equal to tail, then the whole file will be returned.
  * A value of -1 will return the whole file.

```json JSON icon="js" theme={null}
{
    "endpoint": "YOUR_ENDPOINT_NAME",
    "api_key": "YOUR_VAST_API_KEY",
    "tail": 1000
}
```

## Outputs

If tail has a value of 1000

```json JSON icon="js" theme={null}
{
  "info0": "Last l000 bytes of the info0 log",
  "info1": "Last l000 bytes of the info0 log",
  "trace": "Last l000 bytes of the trace log",
  "debug": "Last l000 bytes of the debug log"
}
```

## Example: Fetching Endpoint Logs with cURL

```curl Curl icon="cube" theme={null}
curl https://run.vast.ai/get_endpoint_logs/ \
-X POST \
-d '{"endpoint" : 123, "api_key" : "API_KEY_HERE"}' \
-H 'Content-Type: application/json'
```

***

# POST [https://run.vast.ai/get\_autogroup\_logs/](https://run.vast.ai/get_autogroup_logs/)

## Inputs

* `id`(int): The ID of the Worker Group
* `api_key`(string): The Vast API key associated with the account that controls the Worker Group.
* `tail` (int): The number of bytes from the end of each log file that will be sent in the response.
  * If the file size is less than or equal to tail, then the whole file will be returned.
  * A value of -1 will return the whole file.

```json JSON icon="js" theme={null}
{
    "id": 1001,
    "api_key": "YOUR_VAST_API_KEY",
    "tail": 1000
}
```

## Outputs

If the value of tail is 1000

```json JSON icon="js" theme={null}
{
  "info0": "Last l000 bytes of the info0 log",
  "info1": "Last l000 bytes of the info0 log",
  "trace": "Last l000 bytes of the trace log",
  "debug": "Last l000 bytes of the debug log"
}
```

## Example: Fetching Worker Group Logs with cURL

```bash Bash theme={null}
curl https://run.vast.ai/get_autogroup_logs/ \
-X POST \
-d '{"id" : 1001, "api_key" : "API_KEY_HERE"}' \
-H 'Content-Type: application/json'
```

<Warning>
  In some cases `info0` may not contain logs for a Worker Group.
</Warning>
