How to view the cluster's log data after enabling logging.

Though you enable logging at the Workspace level, viewing the log data is done at the cluster level, using the cluster’s Grafana logging URL.

Run the following commands on the management cluster:

  1. Execute the following command to get the namespace of your workspace:

    dkp get workspaces
    CODE

    And copy the value under the NAMESPACE column for your workspace.

  2. Set the WORKSPACE_NAMESPACE variable to the namespace copied in the previous step:

    export WORKSPACE_NAMESPACE=<WORKSPACE_NAMESPACE>
    CODE

    Run the following commands on the attached cluster to access the Grafana UI:

    Ensure you switched to the correct context or kubeconfig of the attached cluster for the following kubectl commands:

  3. Get the Grafana URL:

    kubectl get ingress -n ${WORKSPACE_NAMESPACE} grafana-logging -o go-template='https://{{with index .status.loadBalancer.ingress 0}}{{or .hostname .ip}}{{end}}{{with index .spec.rules 0}}{{with index .http.paths 0}}{{.path }}{{end}}{{end}}{{"\n"}}'
    CODE

To view logs in Grafana:

  1. Go to the Explore tab:

    kubectl get ingress -n ${WORKSPACE_NAMESPACE} grafana-logging -o go-template='https://{{with index .status.loadBalancer.ingress 0}}{{or .hostname .ip}}{{end}}{{with index .spec.rules 0}}{{with index .http.paths 0}}{{.path }}{{end}}{{end}}/explore{{"\n"}}'
    CODE
  2. You may be prompted to log in using the SSO flow. See Authentication and Authorization for more information.

  3. At the top of the page, change the datasource to Loki.

See the Grafana Loki documentation for more on how to use the interface to view and query logs.

@

Cert-Manager and Traefik must be deployed in the attached cluster to be able to access the Grafana UI. These are deployed by default on the workspace.