-
Notifications
You must be signed in to change notification settings - Fork 1.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
Provide a way to retrieve logs for previous pod instances (similar to --previous option on kubectl) #2408
Comments
Do you know what api is hit behind the scenes with For latter part, Could you please check if this works for you? kubernetes-client/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodTest.java Lines 286 to 290 in 653c79e
|
Looks like it just passes the previous=true:
Not sure the best approach, I guess either adding a getPreviousLog() method or maybe a boolean (previous = true) for the getLog() method (it already has pretty print option). I'll try the specific container approach, I didn't realize that inContainer method existed. Thanks! |
Sorry, I think I said we don't support it without checking. I checked the code and seems like this flag is being passed: Lines 159 to 161 in a007adf
I think this should do the trick for you:
|
The only thing we're missing is adding some documentation about these supported flags |
Thanks, that's what I was looking for, just didn't see it initially. |
@longwa : No worries. I think one of the main problems in this project is that there is not much documentation present for users. I'll try adding documentation for Pod log options here: https://github.com/fabric8io/kubernetes-client/blob/master/doc/CHEATSHEET.md |
@rohanKanojia Most of the API is very intuitive and easy to discover. It's is much easier to use than the official client. |
@longwa : Thanks a lot for your feedback. I also think our API is more friendly to java developers(I used to think I was biased 🙄 ) |
Kubectl allows for the --previous option to logs to view previous instance of the logs.
I can't seem to find a way to do that in the fabric8 API.
Also, I'm not sure how to retrieve logs for a specific container within the pod in cases where there are multiple. Maybe this exists in the API, but I can't find an example of how to do it.
The text was updated successfully, but these errors were encountered: