Accessing pod logs by using Red Hat OpenShift CLI or Kubernetes CLI

To access the application pod logs by using Red Hat® OpenShift® or Kubernetes CLI method, complete the following steps.

Procedure

  1. Log in to the Red Hat OpenShift or Kubernetes cluster by using CLI.
  2. List all the application pods.

    For Red Hat OpenShift, use the following command

    oc get pods –n <namespace>

    For Kubernetes, use the following command

    kubectl get pods –n <namespace>
  3. For execution, enter any pod to check the logs

    For Red Hat OpenShift, use the following command

    oc exec <pod-name> --namespace=<namespace> -it -- sh

    For Kubernetes, use the following command

    kubectl exec <pod-name> --namespace=<namespace> -it -- sh 
  4. Go to the path where pod logs are stored and run the following command to see the application log
    cat <path/of/the/log/file>
    For example, run the command for JTS
    cat /elm/server/conf/jts/logs/repotools-jts_createTables.log