Logs & debugging

Logs and debugging

Read and search logs, check resource use, diagnose problems, and open a shell in your app.

stackblaze logs

Prints the linked app's logs, oldest first. By default it shows recent lines from the running app, falling back to the log store for the last --minutes when there are none.

usage
stackblaze logs [options]

-f streams new lines until you press Ctrl+C and reconnects after network drops. --search queries the durable log store with --query, --level and --minutes. --follow and --search cannot be combined. Build logs are separate: see stackblaze builds logs.

JSON: the default mode prints one document with a logs array; --search prints hits and num_hits; --follow prints one JSON object per line as it arrives.

FlagDescription
-n, --limit <n>Show the newest n lines (with -f, print the last n first; with --search, default 100)
-f, --followStream live logs
--searchSearch the log store instead of the live buffer
-q, --query <text>Full-text query (--search)
--level <level>Log level filter (--search)
--minutes <n>Look-back window in minutes (default 60)
--container <name>Container to read (default: the app's web container)

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags

Examples

terminal
stackblaze logs -n 200
stackblaze logs -f
stackblaze logs -f -n 50 -a worker
stackblaze logs --search -q "timeout" --level error --minutes 180

stackblaze metrics

Prints current CPU (millicores) and memory (MiB) for each running instance of the linked app. For history, use stackblaze diagnose or the dashboard.

usage
stackblaze metrics

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags

Examples

terminal
stackblaze metrics -a api

stackblaze events

Prints the linked app's recent platform events (reason and message). Useful when an app does not start.

usage
stackblaze events

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags

Examples

terminal
stackblaze events -a api

stackblaze diagnose

Collects the app's configuration, metrics, recent logs and add-on state, and reports findings and hints.

usage
stackblaze diagnose [--scale <window>] [--log-minutes <n>]
FlagDescription
--scale <window>Metrics window: 2h (default), 24h or 7d
--log-minutes <n>Log search window in minutes

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app) and the output flags (-o, --output, --json), plus --token and --api-url. Common flags

Examples

terminal
stackblaze diagnose --scale 24h

stackblaze ssh

Opens an interactive terminal inside a running instance of the linked app, over the API: no SSH keys and no open ports. Remote console access must be enabled on the platform; if it is not, the command reports a console error. Exits with the remote session's exit code.

usage
stackblaze ssh [--pod <name>] [--container <name>] [--command <shell>]
FlagDescription
--pod <name>Instance to connect to (default: the app's first instance)
--container <name>Container (default: the web container, else the first)
--command <shell>Command to start (default sh)

Also accepts the scope flags (-p, --pipeline, --phase, -a, --app), plus --token and --api-url. Common flags

Examples

terminal
stackblaze ssh
stackblaze ssh --command bash -a worker