Add combined logs for multi-pod workloads - #2418
Open
krishantt wants to merge 1 commit into
Open
Conversation
Adds a "Logs" action to the workload context menu for Deployments, DaemonSets, StatefulSets, ReplicaSets, and Jobs that opens a single dock tab merging the logs of every child pod, chronologically interleaved and tagged with a per-pod color so lines from different pods are distinguishable at a glance. Single-pod tabs are unaffected. Coloring covers the full log line (tag and message), not just the pod-name tag, so it stays legible whether or not "Show timestamps" is on. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #687.
Adds a "Logs" action to the workload context menu for Deployments,
DaemonSets, StatefulSets, ReplicaSets, and Jobs that opens a single
dock tab merging the logs of every child pod. Lines from all pods are
interleaved chronologically (by the leading RFC3339 timestamp the
Kubernetes API attaches to each line) and tagged with a per-pod color
so it's easy to tell which pod a given line came from at a glance, per
@MatiasRoje's suggestion on #687 ("Probably in different colors
depending on the pod"). Single-pod log tabs are unchanged.
This covers the same need as the now-unmaintained
freelens-multi-pod-logs
extension referenced in #687, brought into core per the option
@robertobandini and @MatiasRoje favored in that thread. It doesn't
touch the separate, larger logs-rendering rework (virtual list -> xterm,
selection-during-scroll) raised in #1170 and referenced from #687 --
that's scoped as its own follow-up.
merge-pod-logs.ts: k-way merge across each pod's log lines, with adeterministic per-pod ANSI color assigned by hashing the pod name.
The whole tagged line (pod-name tag and message) is colored, not
just the tag, so lines stay legible whether or not "Show timestamps"
is on.
store.ts: fetches each pod's logs in parallel (Promise.allSettled)and only blanks the tab if every pod's fetch fails, so one pod being
briefly unreachable doesn't wipe out logs still streaming from the
rest of a combined tab.
resource-selector.tsx: combined tabs show a "N pods" badge (with atooltip listing pod names) instead of the single-pod switcher.
logs-view-model.ts/download-all-logs-for-pods.injectable.ts:downloading a combined tab's logs is named after the owning
workload rather than any single pod.
Manually verified against a 3-replica Deployment on a local cluster,
including with "Show timestamps" toggled on.
| Model:
claude-sonnet-5