# Get logs for a Dagster run

> dg api log get $1 --json | jq --arg level "$2" '.logs[] | select(.level == $level)'

- Skill: `tools-only/get-logs-for-a-dagster-run` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/get-logs-for-a-dagster-run`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/get-logs-for-a-dagster-run/raw
- Safety review: pending (external: skill-scanner WARNING, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/get-logs-for-a-dagster-run

---

# Get logs for a Dagster run

Retrieve and display logs for the specified run ID.

**Usage:** `/dg:logs <run-id> [level] [limit]`

Parameters:

- `$1` (required): Run ID
- `$2` (optional): Log level filter (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- `$3` (optional): Maximum number of log entries to return

## Execution

First, fetch the logs using the `dg api log get` command:

    dg api log get $1 --json

If a log level filter is provided (e.g., ERROR, WARNING), filter the logs:

    dg api log get $1 --json | jq --arg level "$2" '.logs[] | select(.level == $level)'

If a limit is specified, apply it to the results:

    dg api log get $1 --limit $3 --json

If both level and limit are provided:

    dg api log get $1 --level $2 --limit $3 --json

## Display

Parse and display the logs in a readable format showing:

1. **Timestamp** - When the log entry occurred
2. **Level** - Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
3. **Step** - Which step generated the log (if applicable)
4. **Message** - The log message content

Organize logs chronologically and highlight ERROR and CRITICAL level logs for easy identification.

If no logs are found, inform the user that the run exists but has no logs matching the criteria.

