Bug 1815016

Summary: [RFE] oc logs --all-containers does not use marker to mark the beginning for each container
Product: OpenShift Container Platform Reporter: Xingxing Xia <xxia>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-04 11:47:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xingxing Xia 2020-03-19 10:38:27 UTC
Description of problem:
To debug container logs of multiple-container pod like kube-apiserver, a single `oc logs --all-containers pod_name > pod.log` is convenient, but it does not use marker for the beginning of each container log. This makes user hard to locate the beginning and ending for each container's logs in thousands of lines logs.

Version-Release number of selected component (if applicable):
latest oc got from `oc adm release extract --command oc registry.svc.ci.openshift.org/ocp/release:4.4.0-0.nightly-2020-03-18-102708`

How reproducible:
Always

Steps to Reproduce:
1. oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/pods/pod_with_two_containers.json

2. $ oc logs doublecontainers -c hello-openshift
Started, serving at 8080
$ oc logs doublecontainers -c hello-openshift-fedora
serving on 8081
serving on 8888
$ oc logs doublecontainers --all-containers
Started, serving at 8080
serving on 8081
serving on 8888

Actual results:
2. oc logs --all-containers does not use marker to mark the beginning for each container

Expected results:
2. Should have some marker for easy view in situation of thousands of lines logs.

Comment 1 Maciej Szulik 2020-03-20 09:20:39 UTC
This should be already available with --prefix flag which should add pod and/or container name in front of the logs.

Comment 4 zhou ying 2020-03-23 01:49:31 UTC
[root@dhcp-140-138 ~]# oc logs doublecontainers --all-containers --prefix=true
[pod/doublecontainers/hello-openshift] Started, serving at 8080
[pod/doublecontainers/hello-openshift-fedora] serving on 8081
[pod/doublecontainers/hello-openshift-fedora] serving on 8888
[root@dhcp-140-138 ~]# oc version -o yaml 
clientVersion:
  buildDate: "2020-03-23T01:14:57Z"
  compiler: gc
  gitCommit: 2576e482bf003e34e67ba3d69edcf5d411cfd6f3
  gitTreeState: clean
  gitVersion: 4.4.0-202003230106-2576e48
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64

Comment 6 errata-xmlrpc 2020-05-04 11:47:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0581