View Project Log Data

How to view project log data within multi-tenant logging

You can only view the log data for a Project to which you have been granted access.

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

  1. Ensure to switch to the correct context or Kubeconfig of the attached cluster for the following kubectl commands.

  2. Set the environment variables needed for the following procedure with the command:

    export WORKSPACE_NAMESPACE=$(kubectl get workspace <type_your_workspace_name> -o jsonpath='{.status.namespaceRef.name}')
    export PROJECT_NAMESPACE=$(kubectl get project -n ${WORKSPACE_NAMESPACE} <type_your_project_name> -o jsonpath='{.status.namespaceRef.name}')
    
  3. Get the Grafana URL:

    kubectl get ingress -n ${PROJECT_NAMESPACE} project-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"}}'
    

To view logs in Grafana:

  1. Go to the Explore tab:

    kubectl get ingress -n ${PROJECT_NAMESPACE} project-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"}}'
    
  2. You may be prompted to log in using the SSO flow. See Kommander Security 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.

View Grafana Loki Logs

IMPORTANT: 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.

You can configure project policy to restrict access to the Project logging Grafana UI.