1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/viewing-resource-logs-cli-console.adoc
Satyajeet Munje cc94fd4ee0 OBSDOCS-693
2024-04-24 18:11:38 +00:00

78 lines
1.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * observability/logging/log_visualization/log-visualization.adoc
// * nodes/pods/nodes-pods-viewing.adoc
:_mod-docs-content-type: PROCEDURE
[id="viewing-resource-logs-cli-console_{context}"]
= Viewing resource logs
You can view the log for various resources in the {oc-first} and web console. Logs read from the tail, or end, of the log.
.Prerequisites
* Access to the {oc-first}.
.Procedure (UI)
. In the {product-title} console, navigate to *Workloads* -> *Pods* or navigate to the pod through the resource you want to investigate.
+
[NOTE]
====
Some resources, such as builds, do not have pods to query directly. In such instances, you can locate the *Logs* link on the *Details* page for the resource.
====
. Select a project from the drop-down menu.
. Click the name of the pod you want to investigate.
. Click *Logs*.
.Procedure (CLI)
** View the log for a specific pod:
+
[source,terminal]
----
$ oc logs -f <pod_name> -c <container_name>
----
+
--
where:
`-f`:: Optional: Specifies that the output follows what is being written into the logs.
`<pod_name>`:: Specifies the name of the pod.
`<container_name>`:: Optional: Specifies the name of a container. When a pod has more than one container, you must specify the container name.
--
+
For example:
+
[source,terminal]
----
$ oc logs ruby-58cd97df55-mww7r
----
+
[source,terminal]
----
$ oc logs -f ruby-57f7f4855b-znl92 -c ruby
----
+
The contents of log files are printed out.
** View the log for a specific resource:
+
[source,terminal]
----
$ oc logs <object_type>/<resource_name> <1>
----
<1> Specifies the resource type and name.
+
For example:
+
[source,terminal]
----
$ oc logs deployment/ruby
----
+
The contents of log files are printed out.