-
Notifications
You must be signed in to change notification settings - Fork 39.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print pod name in kubectl logs when using label selector #44812
Comments
@kubernetes/sig-cli-feature-requests @kubernetes/sig-api-machinery-misc |
Is there a capsule design for label selected pods for logs? |
imho, no such capsule design, should we add one for this? @smarterclayton |
What does "capsule design" mean? |
Just wondering why we couldn't do something very general like pass a formatting modifier string as a flag to other CLI command. Similar to server side queries but more general. xref: http://research.cs.wisc.edu/htcondor/manual/current/condor_status.html see -format |
This does seem like a feature request for kubectl. If it needs a feature from server, please file a separate issue. |
The API server would potentially need to support multiple streams of logs coming back from a pod, depending on the implementation. Which is why I asked what the design would be. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
This would be really helpful. A flag like |
@Nowaker: Reiterating the mentions to trigger a notification: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Could someone from @kubernetes/sig-cli-feature-requests take a look at this and comment, please? Thanks! |
@Nowaker: Reiterating the mentions to trigger a notification: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lifecycle rotten |
/remove-lifecycle rotten |
Update: I'm trying out https://github.com/wercker/stern instead. Hopefully this helps someone, I've only tested it very briefly on darwin/BSD. function kublogs {
__label_args=${@:1:2}
__logs_args=${@:3}
kubectl get po $__label_args -o name | cut -d / -f 2 | xargs -I{} bash -c 'sed -E "s/([0-9]{5})([0-9]+)?Z/\1Z $1/" <(kubectl logs $1 --timestamps ${@:2})' echo {} $__logs_args
} kublogs -l app=my-deployment --since 1h -c some-container It will print the timestamp first, but will be run against each pod individually. Pipe through |
Can't live without https://github.com/johanhaleby/kubetail. Simple syntax, colored output (different color per pod). |
Now available in the form of |
Add
kubectl logs
flag to include pod name on each line in log output. Similar todocker-compose logs
. Ideally behind a flag.The text was updated successfully, but these errors were encountered: