Configure Loki as Data Source for Grafana

Configure Loki as Data Source for Grafana

Grafana has built-in support for Loki for querying and displaying the logs. In this tutorial we will explain how to configure Loki as data source for Grafana.

Before beginning, make sure you have installed Grafana, Loki and Promtail in your system.

Open a web browser and log in to the Grafana dashboard. In the side menu click on "Configuration" (cog icon) and choose "Data sources". Click "Add data source" button. Scroll down to the "Logging & document databases" section and select "Loki". Enter the name of data source and URL of Loki server. Press "Save & test".

Loki connection details for Grafana

To view the logs, click on "Explore" in the side menu. In the top-left dropdown choose the Loki datasource (1). Click "Log browser" button (2) and select a log file (e.g. /var/log/syslog).

View Loki logs in Grafana

At the bottom of the page you will see log file entries.

Leave a Comment

Cancel reply

Your email address will not be published.