k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Combined Logs: print logs of multiple containers in one view

Open wolfgang-stark opened this issue 5 years ago • 15 comments




When having multiple replicas (meaning multiple containers) I can't print all logs at once.

It would be awesome if it I could select multiple containers using <space> and hit <L> afterwards to get a single log view, which displays the log messages of all containers with a container-id-prefix.

Right now i can only achieve this by opening multiple terminal tabs.

Thanks!

wolfgang-stark avatar Jul 29 '20 11:07 wolfgang-stark

@wolfgang-braun Currently k9s will list all containers in a pod. You can view all associated containers logs by pressing l on the selected pod. Are you looking for a different behavior? If so please clarify. Tx!

derailed avatar Jul 31 '20 17:07 derailed

@derailed thanks for your reply. The tool is really awesome.

I mean that it would be cool to tail the logs of multiple pods at once.

Currently you can multiselect them to delete them. It’d be great to use this selection feature to print all logs of the selected pods.

wolfgang-stark avatar Aug 02 '20 18:08 wolfgang-stark

Agreed this would be useful for me too -- currently I do this with stern filters outside of k9s.

rocketraman avatar Aug 13 '20 13:08 rocketraman

You may press l on the parent resource (e.g. deployment, services, statefulset) for all related pods. Is that good enough?

yujunz avatar Oct 29 '20 13:10 yujunz

You may press l on the parent resource (e.g. deployment, services, statefulset) for all related pods. Is that good enough?

@yujunz Not in my situation... my use case is selecting pods from different deployments, and ideally being able to select different deployments and seeing logs from every related pod.

rocketraman avatar Oct 29 '20 13:10 rocketraman

You may press l on the parent resource (e.g. deployment, services, statefulset) for all related pods. Is that good enough?

@yujunz Also not in my situation, because the parents contain pods I don't want to see the logs for.

wolfgang-stark avatar Nov 20 '20 09:11 wolfgang-stark

@wolfgang-braun <space> to multi-select? I tried holding shift while down-arrowing and no luck... Then I read your post. Thanks!

bentito avatar Feb 10 '21 21:02 bentito

With the stern plugin this should be possible but as we do not have a $SELECTION variable we can only use $FILTER which is not exact enough, @derailed would it be possible to implement $SELECTION for plugins?

NemesisRE avatar Jan 27 '22 10:01 NemesisRE