Skip to content

How to add a Grafana Dashboard for Logging v2

This document (000020012) is provided subject to the disclaimer at the end of this document.

Environment

A cluster managed by Rancher v2.5.x+ with Monitoring and Logging v2 apps installed

Situation

Vistualising Logging statistics can be useful for troubleshooting and capacity planning, this article demonstrates how to add a Logging Dashboard to Grafana with persistence throughout pod restarts.

The article focusses on a Logging Dashboard, however these same steps can be adapted to suit other Dashboards.

Resolution

  • Upgrade the Logging v2 app to enable the service monitor by clicking 'Chart Options' and 'Edit as YAML', below is an example showing the monitoring.serviceMonitorsection.enabled field set to true:
monitoring:
  serviceMonitor:
    enabled: true

Once complete, the target ( cattle-logging-system/rancher-logging) should show up in the Prometheus Targets list with an UP state - this can take a few minutes

Add a logging dashboard to Grafana by adding the JSON to a ConfigMap for persistence . In this example, the Logging Dashboard is used

  • Click the 'Download JSON' button for the Dashboard

  • Replace the data source variable with Prometheus in the downloaded file

For example:

sed 's/${DS_PROMETHEUS}/Prometheus/' logging-dashboard_rev4.json > logging.json
  • Create and label the ConfigMap using the updated logging.json file
kubectl create configmap --from-file logging.json logging -n cattle-dashboards
kubectl label configmap  -n cattle-dashboards logging grafana_dashboard=1
  • Visit the Grafana UI, the Dashboard should now be available

Further reading

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.