Skip to content

feat: Add 'supabase logs' command for unified cloud log streaming (that AI agents will love) #4851

@tristanbob

Description

@tristanbob

Is your feature request related to a problem? Please describe.

When building with AI agents that manage Supabase projects, there is no CLI command for the agent to view unified project logs without leaving the terminal or navigating the Supabase Dashboard web UI.

While the Supabase MCP Server exposes a get_logs tool that can retrieve service logs (API, Postgres, Edge Functions, Auth, etc.), this functionality is missing from the supabase CLI itself. Agents often default to using the CLI, and the lack of a logging command creates a "blind spot" where the agent cannot debug errors without human intervention to copy-paste logs from the web dashboard.

Describe the solution you'd like

I would like a unified supabase logs command that mirrors the functionality found in the MCP server and other modern cloud CLIs (like Vercel, AWS, Fly.io, etc).

Proposed Command Signature:

supabase logs [options]

Desired Options:

  • --project-ref : Target a specific project (optional if linked).
  • -f, --follow: Stream logs in real-time.
  • --source : Filter by source. Valid values: all, postgres, auth, api, storage, edge. Default: all.
  • --since : Return logs newer than a relative duration (e.g., 1h, 10m, 2d).
  • --search : Filter logs by a text search string (server-side filter preferred).
  • -n, --limit : Maximum number of log lines to return (default: 100).
  • --json: Output in JSON lines format (critical for AI agents to parse).

Example Usage:

# View last 100 logs from all sources
supabase logs

# Stream Postgres logs specifically
supabase logs --source postgres -f

# Fetch logs from the last 10 minutes containing "error" in JSON format
supabase logs --since 10m --search "error" --json

Describe alternatives you've considered

  1. Using the Web Dashboard: This breaks the terminal workflow and is inaccessible to AI agents.
  2. Using the MCP Server: While the MCP server has get_logs, not all workflows utilize MCP. The CLI is the lowest common denominator for automation scripts and CI/CD.
  3. SQL Queries: One can theoretically query supabase_logs via SQL, but this is complex to construct on the fly and doesn't support easy "tailing" (streaming).
  4. Local Docker Logs: docker logs works for local development, but there is no equivalent for hosted projects.

Additional context

Competitive Analysis (CLI Log Capabilities):
Supabase is currently the only major provider in this list without a native CLI log streaming command.

Provider Command Key Features
Vercel vercel logs --follow, --since, --output json
Heroku heroku logs --tail, --source, --num
Fly.io fly logs -i (instance), -r (region), live by default
Cloudflare wrangler tail Live streaming of Worker/Pages logs
AWS aws logs tail --follow, --filter-pattern
Azure az webapp log tail Live tracing
Supabase (none / missing) Must use Web UI or raw SQL

Existing Capability:

Since the Supabase MCP server already implements get_logs (fetching from API, Postgres, Auth, etc.), the underlying API endpoints to retrieve this data clearly exist. Exposing this via the CLI would bring feature parity between the MCP layer and the CLI layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions