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
Add kubectl log --previous support to view last terminated container log #7973
Conversation
b249d58
to
7b02238
Compare
@@ -404,6 +404,8 @@ _kubectl_log() | |||
flags+=("--help") | |||
flags+=("-h") | |||
flags+=("--interactive") | |||
flags+=("--previous") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Can this be last
instead of previous
? And do we need the -p
short flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-p is supported already.
--previous was chosen by our UX lead: @bgrant0607 over --last :-) |
@@ -298,7 +298,7 @@ func (dm *DockerManager) inspectContainer(dockerID, containerName, tPath string) | |||
if found { | |||
data, err := ioutil.ReadFile(path) | |||
if err != nil { | |||
glog.Errorf("Error on reading termination-log %s: %v", path, err) | |||
//glog.Errorf("Error on reading termination-log %s: %v", path, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this change is unintentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, someone breaks that feature which generates tons of logging messages. Fixed it. Thanks!
Just a few minor nits. Overall LGTM. Thanks for this feature @dchen1107. This will be very useful. |
Addressed your comments, PTAL? |
LGTM. WIll merge once tests pass. |
Add kubectl log --previous support to view last terminated container log
thanks for adding this and sorry I was not able to review it earlier. It lgtm and and is a big help when actually building apps on Kube |
Fixed #4640.
View current running container:
View last terminated container:
If the last terminated container is not exist:
cc/ @vishh