Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"pods/templates/secrets"
]
},
"pods/Pod-logs-metrics",
{
"group": "Troubleshooting",
"pages": [
Expand Down
62 changes: 62 additions & 0 deletions pods/Pod-logs-metrics.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "Pod logs and metrics"
sidebarTitle: "Logs and metrics"
description: "Pull Pod logs and metrics from the Runpod API into your data lake, monitoring stack, or Prometheus instance."
---

Use the Runpod API to retrieve logs and metrics for your Pods programmatically. Both endpoints authenticate with your Runpod API key.

## Prerequisites

You can find all of the following in the [console](https://console.runpod.io).

- A Runpod API key. Generate one under **Settings → API Keys**.
- Your Pod ID. Find it on the **Pods** page.
- Your Team ID. Required for team accounts only and not required for personal accounts.
- Go to **Account → Team** in the left navigation. Your Team ID is shown in the top right of the page next to **ID**.

Check warning on line 16 in pods/Pod-logs-metrics.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

pods/Pod-logs-metrics.mdx#L16

In general, use active voice instead of passive voice ('is shown').
- You must be a team owner or admin to access this page.

Check warning on line 17 in pods/Pod-logs-metrics.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

pods/Pod-logs-metrics.mdx#L17

Use 'administrator' instead of 'admin'.

## Pod logs

The logs endpoint supports two modes:

- **Streaming** (`?stream=true`): Returns a live log stream. Limited to 5 concurrent connections per Pod. Additional connections return `429` with `"too many concurrent log streams"`.

Check warning on line 23 in pods/Pod-logs-metrics.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

pods/Pod-logs-metrics.mdx#L23

Use parentheses judiciously.
- **Snapshot** (default): Returns a point-in-time snapshot of logs.

Check warning on line 24 in pods/Pod-logs-metrics.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

pods/Pod-logs-metrics.mdx#L24

Use parentheses judiciously.

```bash
curl -sS -D - \
-H "Authorization: Bearer $API_KEY" \
-H "X-Team-Id: $TEAM_ID" \
"https://hapi.runpod.net/v1/pod/$POD_ID/logs"
```
For a live stream, append `?stream=true` to the URL.

The X-Team-Id header is not required for personal accounts.

Check warning on line 34 in pods/Pod-logs-metrics.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

pods/Pod-logs-metrics.mdx#L34

Use 'isn't' instead of 'is not'.

## Pod metrics

Retrieve metrics for a running Pod.

```bash
curl -sS -D - \
-H "Authorization: Bearer $API_KEY" \
-H "X-Team-Id: $TEAM_ID" \
"https://hapi.runpod.net/v1/pods/$POD_ID/metrics"
```

A successful response returns JSON with `pod_id`, `timestamp`, and a `metrics` object.

## Rate limits

Both endpoints share the same rate limit: one request every 5 seconds per Pod, with a burst of 3 requests. Requests over the limit return `429`.

## Response codes

| Code | Cause |
|------|-------|
| `200` | Success |
| `401` | Missing or malformed `Authorization` header |
| `403` | Invalid API key, or missing `X-Team-Id` for a team-scoped Pod |
| `404` | Pod not found or not owned by this API key |
| `429` | Rate limit exceeded, or too many concurrent log streams |
| `502`/`503` | Pod host agent unreachable |
Loading