openshiftopenshift-client-tools

How to view openshift online node application logs locally?


I can view my node application logs in the OpenShift Online interface at:

OpenShift > Applications > Deployments > [ pod_name ] > [ deployment_name ] > Logs  

enter image description here

How can I view them locally?


Solution

  • First, to get a list of your pods, run:

    oc get pods
    

    It will return something like:

    NAME                      READY     STATUS      RESTARTS   AGE
    mongodb-24-rtls           1/1       Running     0          45d
    showcase-node-501-build   0/1       Completed   0          21h
    showcase-node-502-build   0/1       Completed   0          21h
    showcase-node-530-wcwzm   1/1       Running     1          21h
    

    To view the log screen for the node app, run:

    oc logs showcase-node-530-wcwzm -f