Skip to content

lnav shows garbled ANSI/control sequences when piping stern raw logs during rolling updates #1611

@awaken233

Description

@awaken233

lnav version

v0.13.2

Environment

  • OS: macOS 13.7.8 (22H730)
  • Shell: zsh 5.9 (x86_64-apple-darwin22.0)
  • tmux: 3.6a
  • TERM: screen-256color

tmux config

set -g default-terminal "tmux-256color"

Describe the bug

When piping Kubernetes pod logs produced by stern into lnav, the display shows garbled ANSI/control sequences and rendering artifacts during rolling updates. Example command used:

stern -l app=xxx-app --output raw --color never | lnav

During a deployment rolling update the streamed output sometimes contains control sequences and fragments (visible as raw text and overlapping characters) instead of being rendered correctly by lnav. The UI shows what looks like partial escape sequences and corrupted glyphs making the logs unreadable.

Observed behavior

  • Raw/garbled sequences appear in the lnav interface (escape sequences shown as literal text).
  • Rendering is unstable while the deployment is rolling (lines overlap or appear corrupted).
  • The garbage appears when stern streams logs from multiple pods during the rolling update; some control sequences (carriage returns, progress bars, or color/metadata sequences) are not being interpreted or are fragmented.

To Reproduce

  1. Start streaming logs from a Kubernetes app that performs a rolling update:
    • stern -l app=xxx-app --output raw --color never | lnav
  2. Trigger a rolling deployment/update for that app (so pods are restarted/rotated).
  3. Observe lnav while new pods start and old pods shut down — at some point the interface shows garbled escape sequences and rendering artifacts (screenshot attached).
Image

Expected behavior

lnav should either:

  • Cleanly ignore/normalize stray control sequences from interleaved streams so they aren't shown as raw text; or
  • Gracefully render/strip ANSI/control codes even when fragments are split across multiple writes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions