This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Este contenido no está disponible en el idioma seleccionado.
Chapter 6. Viewing cluster logs
You can view OpenShift Container Platform cluster logs in the CLI or OpenShift Container Platform web console.
6.1. Viewing cluster logs Copiar enlaceEnlace copiado en el portapapeles!
You can view cluster logs in the CLI.
Prerequisites
- Cluster logging and Elasticsearch must be installed.
Procedure
To view cluster logs:
Determine if the log location is a file or
CONSOLE(stdout).oc -n openshift-logging set env daemonset/fluentd --list | grep LOGGING_FILE_PATH
$ oc -n openshift-logging set env daemonset/fluentd --list | grep LOGGING_FILE_PATHCopy to Clipboard Copied! Toggle word wrap Toggle overflow Depending on the log location, execute the logging command:
If
LOGGING_FILE_PATHpoints to a file, the default, use the logs utility, from the project, where the pod is located, to print out the contents of Fluentd log files:oc exec <any-fluentd-pod> -- logs
$ oc exec <any-fluentd-pod> -- logs1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the name of a log collector pod. Note the space before
logs.
For example:
oc exec fluentd-ht42r -n openshift-logging -- logs
$ oc exec fluentd-ht42r -n openshift-logging -- logsCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you are using
LOGGING_FILE_PATH=console, the log collector writes logs to stdout/stderr`. You can retrieve the logs with theoc logs [-f] <pod_name>command, where the-fis optional.oc logs -f <any-fluentd-pod> -n openshift-logging
$ oc logs -f <any-fluentd-pod> -n openshift-logging1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the name of a log collector pod. Use the
-foption to follow what is being written into the logs.
For example
oc logs -f fluentd-ht42r -n openshift-logging
$ oc logs -f fluentd-ht42r -n openshift-loggingCopy to Clipboard Copied! Toggle word wrap Toggle overflow The contents of log files are printed out.
By default, Fluentd reads logs from the tail, or end, of the log.
6.2. Viewing cluster logs in the OpenShift Container Platform web console Copiar enlaceEnlace copiado en el portapapeles!
You can view cluster logs in the OpenShift Container Platform web console .
Prerequisites
- Cluster logging and Elasticsearch must be installed.
Procedure
To view cluster logs:
-
In the OpenShift Container Platform console, navigate to Workloads
Pods. -
Select the
openshift-loggingproject from the drop-down menu. -
Click one of the logging collector pods with the
fluentdprefix. - Click Logs.
By default, Fluentd reads logs from the tail, or end, of the log.