====================
Viewing system logs
====================

To help you gain insights into user services and troubleshoot issues, Data Science & AI Workbench provides detailed 
logs and debugging information related to the Kubernetes services and containers it uses.

**To access these logs from the Operations Center:**

#. Log in to Workbench, select |menu| **Menu** in the top right corner, and click the **Administrative Console** link displayed at the bottom of the slide out window.


#. Click **Manage Resources**.

#. Log in to the Operations Center using the Administrator credentials :doc:`configured after installation </install/config>`.

#. Click **Logs** in the left menu to display the complete system log.

#. Use the **Filter** drop-down to view logs based on a container.

.. thumbnail:: ../../../images/ops-center-logs-filter.png
   :align: center

.. note::
   You can also access the logs for a specific pod by clicking **Kubernetes** in the left menu, clicking the **Pods** tab, clicking the name of a pod, and selecting **Logs**.

Individual pods
===============
To display the logs for a user session or deployment you'll
need to identify the appropriate Kubernetes pod name.

For an editor session the Kubernetes pod name corresponds to the hostname
of the session container. Run ``hostname`` in a terminal window. For
deployments the pod name is available from the logs tab of the deployment
under the heading **name**.

#. Click the **Kubernetes** tab from the menu on the left.

#. Click the **Pods** tab to display a list of all pods and containers.
   Editor sessions are named ``anaconda-session-XXXXX`` and deployments are
   named ``anaconda-app-XXXX``.

   .. thumbnail:: ../../../images/session-pods.png
      :align: center

#. For the chosen pod click the pull-down button on an individual container
   to view the **Logs** or to gain SSH access.

.. thumbnail:: ../../../images/session-container-menu.png
   :align: center

**To use the CLI:**

#. Open an SSH session on the master node in a terminal by logging into the
   Operations Center and selecting **Servers** from the menu on the left.

#. Click on the IP address for the Workbench master node and select
   SSH login as **root**.

#. In the terminal window, run ``sudo gravity enter``.

#. Run ``kubectl get pods`` to view a list of all running session pods.

#. Run ``kubectl logs <POD-NAME>`` to display the logs for the pod specified.

.. |menu| image:: /images/icons/menu.png
          :width: 25 px
