You can view cluster logs in the CLI.
-
Cluster logging and Elasticsearch must be installed.
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
-
Depending on the log location, execute the logging command:
-
If
LOGGING_FILE_PATH
points 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 (1)
-
Specify the name of a log collector pod. Note the space before
logs
.For example:
$ oc exec fluentd-ht42r -n openshift-logging -- logs
-
-
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-f
is optional.$ oc logs -f <any-fluentd-pod> -n openshift-logging (1)
-
Specify the name of a log collector pod. Use the
-f
option to follow what is being written into the logs.For example
$ oc logs -f fluentd-ht42r -n openshift-logging
The contents of log files are printed out.
By default, Fluentd reads logs from the tail, or end, of the log.
-
-