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.adoc
2025-09-04 13:56:35 +00:00

52 lines
1.1 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_{context}"]
= Viewing resource logs by using the CLI
Use the following procedure to view resource logs by using the command-line interface (CLI).
.Prerequisites
* Access to the {oc-first}.
.Procedure
* View the log for a specific pod by entering the following command:
+
[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 -f ruby-57f7f4855b-znl92 -c ruby
----
* View the log for a specific resource by entering the following command:
+
[source,terminal]
----
$ oc logs <object_type>/<resource_name>
----
+
For example:
+
[source,terminal]
----
$ oc logs deployment/ruby
----