- OpenShift CLI reference for viewing logs.
- The Container Service retains log data for 90 days.
Logs for running pods are visible from within the OpenShift UI. Go to: Applications > Pods, and select Logs from the following tabbed list:
From within the ‘Logs’ tab, clicking on the ‘View Archive’ anchor just above the current log on the right side will launch Kibana. Use Kibana to view logs from previous pods.
Viewing Logs Directly in Kibana
In addition to accessing log data from within the OpenShift interface, logs are directly available at https://kibana.webplatformsunpublished.umich.edu/. That will load the last project you accessed from Kibana, but won't load logs for any particular pod.
Log Search Syntax
The logs can be searched for text with a query similar to the one below. This will search for the string "users added" in all logs emanating from the "my-sample-application" project:
kubernetes.namespace_name:"my-sample-application" AND "users added"
Below is a sample query to find log lines that contain a entry and count for "users added:" while ignoring those where the count is zero in the current project:
"users added:" AND NOT "added: 0"
The message field corresponds to the log message itself. The kubernetes.pod_name field is the name of the pod which produced the log.
A elasticsearch (Kibana) syntax cheat sheet is at: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax
To follow logs for a build config
oc logs -f bc/os-docker-build
To get the log for a currently running pod:
oc logs -f <pod>