Skip to content

Cockpit: add /api/logs endpoint #12

@samim23

Description

@samim23

Context

Spawn has a Logs tab in the agent dashboard that calls the cockpit's API to retrieve node logs. Currently this fails because the cockpit server has no /api/logs endpoint — the tab was hidden as a workaround.

Request

Add a GET /api/logs endpoint to the cockpit HTTP server that returns recent log output from the node.

Suggested behavior

  • Returns the last N lines of structured log output (default 100, configurable via ?limit= query param)
  • Requires Authorization: Bearer <auth_token> (same as other cockpit endpoints)
  • Response format:
{
  "logs": [
    {"timestamp": "2026-03-02T14:30:00Z", "level": "info", "message": "Peer connected: ab3f..."},
    {"timestamp": "2026-03-02T14:30:01Z", "level": "warn", "message": "Skill timeout: summarize"}
  ]
}

Why

Hosting providers need to surface node logs to operators without requiring SSH access to the VPS. The cockpit already exposes /api/status — logs are the natural complement.

Alternative considered

Pulling journalctl output via SSH from the management plane. Works but is heavy, requires SSH credentials in the hosting service, and bypasses the cockpit's auth model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogNot planned for near-term sprints

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions