Openshift logs

Last modified by aulembin@helsinki_fi on 2024/02/07 06:33

OpenShift collects logs from both the build phase and from running pods. The logs are kept for 10 days*, and in addition to the resources below, they can be viewed from Kibana. Logs for running pods are kept back to the same same 10 days*.

*This is prone to change if storage is running low, the minimum will be at least 4 days so that on Monday you can see the logs from Friday.

Logs in the web console



Administrator view

Pod: Workloads → Pods → Choose a pod → Logs

Build:  Builds → Builds → Choose a build → Logs


Dev view

Pod: Topology → Choose a deployment → Select a Pod from the "Pods" list → Logs

Build: Topology → Choose a deployment → Select a Build from  the "Builds" list → Logs

tai Builds → Choose a BuildConfig → Builds → Select a Build → Logs

Logs with the OpenShift client


Build

$ oc describe build <build_name>


BuildConfig

$ oc logs -f bc/<buildconfig_name>


Pod

oc logs -f <pod_name> -c <container_name>

More info in RedHat documentation:

Build & Config

Pods

Logs in Kibana

Kibana can be accessed through the top bar of the OpenShift web console by clicking the 3-by-3 boxes → Logging. After logging in using the same login that you used for OpenShift, go to 'Management' and 'Add index pattern'. The index pattern should be app*. Click 'Next step' and choose @timestamp from the drop-down. Now logs can be viewed by choosing 'Visualize' from the left. If you wish to filter by namespace you should add the field kubernetes.namespace_name.

Changing the tracked logs

By default projects added to OpenShift save the logs for the last 5 successful and unsuccessful Builds. If you wish to change these values, the are defined in the BuildConfig.yaml like this:

spec:
  ...
  successfulBuildsHistoryLimit: 5
  failedBuildsHistoryLimit: 5

If you want the logs to be more accurate, change the number below:

sourceStrategy:
...
  env:
    - name: "BUILD_LOGLEVEL"
      value: "2" 

Explanations for the numbers and extra information


Contact information

The recommended contact for questions is:

https://helsinkifi.slack.com #kontit 

All changes related to resources for the project/namespace should be emailed to:

grp-openshift-owner@helsinki.fi (platform administration and development)tike-ohjelmistotuotanto@helsinki.fi (program development)