Skip to content

Feature: Update kdm logs command to be interactive #138

@utkarsh232005

Description

@utkarsh232005

🎯 Goal

Convert the kdm logs command from a simple log dump into an interactive log viewer with a fuzzy resource selector, pausable streaming, and in-log search with color-coded severity levels.


📌 Current Behavior

kdm logs <name> retrieves logs from a workload. KDM attempts a Docker container prefix match first, falling back to Kubernetes pods if no matching container is found.

Parameters:

Param Description
<name> Container name/ID prefix or Kubernetes pod name

Example usage:

kdm logs auth-api

🚀 Proposed Interactive Dashboard

Stage 1 — Fuzzy Resource Selector (when no <name> is provided)

Select a resource to view logs:

  🔍 Search: ng

  > nginx-123         (k8s pod)
    nginx-proxy       (docker)
    backend-api       (k8s pod)

  ↑↓:Navigate  ENTER:Select  Q:Quit

Stage 2 — Interactive Log Viewer

  nginx-123 — Logs                            [STREAMING]
  ──────────────────────────────────────────────────────

  2026-06-08 12:01:02  INFO   Server started on port 8080
  2026-06-08 12:01:03  INFO   Database connected
  2026-06-08 12:02:15  ERROR  Redis connection timeout
  2026-06-08 12:02:16  WARN   Retrying in 5s...
  2026-06-08 12:02:21  INFO   Redis reconnected

  ──────────────────────────────────────────────────────
  SPACE:Pause  /:Search  T:Timestamps  Q:Quit

User Flow

  1. Run kdm logs (no argument) → fuzzy selector opens. Type to filter, press Enter to select.
  2. Run kdm logs nginx → directly opens log stream.
  3. Logs stream in real time with color-coded severity:
    • ERROR → 🔴 Red
    • WARN → 🟡 Yellow
    • INFO → 🟢 Green
    • DEBUG → 🔵 Blue
  4. Press Space to pause/resume streaming (status toggles between [STREAMING] and [PAUSED]).
  5. Press / to search within logs — matches highlight. Use n (next) / N (previous) to jump between matches.
  6. Press t to toggle timestamp prefixes on/off.

Keyboard Shortcuts

Key Action
/ Navigate selector / scroll logs
Enter Select resource
Space Pause / resume streaming
/ Search within logs
n / N Next / previous search match
t Toggle timestamps
Q Quit

Recommended Libraries

Component Library
Fuzzy selector ink-select-input
Search input ink-text-input
Log coloring chalk

📋 Contribution Workflow

  1. Fork the repo and create a feature branch (e.g., feature/interactive-kdm-logs).
  2. Implement the interactive TUI for kdm logs using the layout and flow described above.
  3. Submit a PR explicitly linked to this issue (e.g., Closes #138).
  4. 📸 Include a screenshot or recording of the implemented UI in your PR to verify the new dashboard experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions