Oc logs: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=External=
=External=


* https://docs.openshift.com/enterprise/3.1/cli_reference/basic_cli_operations.html#logs
* https://docs.openshift.com/enterprise/3.1/cli_reference/basic_cli_operations.html#logs
=Internal=


* [[Oc#logs|oc]]
* [[Oc#logs|oc]]
Line 9: Line 9:
=Overview=
=Overview=


Retrieves the log output for a build, deployment or pod:
Retrieves the log output for a build, deployment or pod.
 
To retrieve the logs for a lone container running on a pod, use:
 
oc logs -f <''pod-name''>
 
If the pod runs more than one container, the container name must be specified with -c:
 
oc logs -f <''pod-name''> -c <''container-name''>
 
Example:
 
oc logs -f logging-kibana-1-d4bw2 -c kibana-proxy
 
=Options=
 
==-f==
 
Streams the logs, similarly to tail -f.
 
Can be used for [[OpenShift_Troubleshooting#Troubleshooting_Pods|pod troubleshooting]]:
 
oc logs -f <''pod-name''>
 
==-c==
 
Container name, when more than one container runs in the pod.
 
==-p==
 
Print the logs for the previous instance of the specified pod/container (if they exist), even if the instance does not exist anymore.


<pre>
oc logs -p synthlog-1-v938r
oc logs -f <pod>
</pre>


=Sub-Commands=
=Sub-Commands=

Latest revision as of 00:38, 10 February 2018

External

Internal

Overview

Retrieves the log output for a build, deployment or pod.

To retrieve the logs for a lone container running on a pod, use:

oc logs -f <pod-name>

If the pod runs more than one container, the container name must be specified with -c:

oc logs -f <pod-name> -c <container-name>

Example:

oc logs -f logging-kibana-1-d4bw2 -c kibana-proxy

Options

-f

Streams the logs, similarly to tail -f.

Can be used for pod troubleshooting:

oc logs -f <pod-name>

-c

Container name, when more than one container runs in the pod.

-p

Print the logs for the previous instance of the specified pod/container (if they exist), even if the instance does not exist anymore.

oc logs -p synthlog-1-v938r

Sub-Commands

build

oc logs build