DEV Community

rick
rick

Posted on • Originally published at ho4040.github.io

runpod-log: A CLI Tool for Viewing RunPod GPU Pod Logs

Why I Built This

RunPod is great for spinning up GPU pods, but there's one frustrating gap: you can't view pod logs from the CLI.

The official runpodctl lets you start, stop, and manage pods — but if you want to check logs, you're forced to open the web console every time. This is especially painful when you're managing multiple pods or trying to build automation scripts.

So I built runpod-log, a simple CLI tool that fetches RunPod GPU pod logs directly in your terminal.

Features

  • Fetch logs instantly — get both container logs and system logs in one command
  • Real-time monitoring — stream logs to a file with the tail command
  • Automatic authentication — browser-based login via Playwright with automatic JWT token refresh

Installation

pip install runpod-log
Enter fullscreen mode Exit fullscreen mode

Usage

# Login (opens browser for authentication)
runpod-log login

# Fetch logs for a specific pod
runpod-log logs <pod-id>

# Filter by log type
runpod-log logs <pod-id> --only container
runpod-log logs <pod-id> --only system

# Real-time log monitoring
runpod-log tail <pod-id> ./logs.txt

# Logout
runpod-log logout
Enter fullscreen mode Exit fullscreen mode

How It Works

Authentication

Since RunPod doesn't offer a public API for logs, runpod-log uses a browser-based authentication flow:

  1. runpod-log login opens a Playwright browser window
  2. You log in to RunPod normally
  3. The tool captures the JWT token from hapi.runpod.net requests
  4. Session data is stored locally — no repeated logins needed

Token Refresh

JWT tokens expire after about 60 seconds. When that happens, runpod-log automatically spins up a headless browser to fetch fresh credentials — no manual intervention required.

Log Retrieval

Under the hood, it calls the undocumented https://hapi.runpod.net/v1/pod/{pod_id}/logs endpoint to fetch both container and system logs.

Why Not Just Use the Web Console?

  • Automation: pipe logs into other tools, grep for errors, trigger alerts
  • Multi-pod management: check logs across pods without switching browser tabs
  • SSH workflows: view logs on remote machines without a GUI

Links


If you're a RunPod user who's been frustrated by the lack of CLI log access, give it a try and let me know what you think!

Top comments (0)