Loki in Grafana

Grafana ships with built-in support for Loki for versions greater than6.0. Using6.3 or later is highlyrecommended to take advantage of new LogQL functionality.

  1. Log into your Grafana instance. If this is your first time runningGrafana, the username and password are both defaulted to admin.
  2. In Grafana, go to Configuration > Data Sources via the cog icon on theleft sidebar.
  3. Click the big + Add data source button.
  4. Choose Loki from the list.
  5. The http URL field should be the address of your Loki server. For example,when running locally or with Docker using port mapping, the address islikely http://localhost:3100. When running with docker-compose orKubernetes, the address is likely https://loki:3100.
  6. To see the logs, click Explore on the sidebar, select the Lokidatasource in the top-left dropdown, and then choose a log stream using theLog labels button.

Read more about Grafana’s Explore feature in theGrafana documentation and on how tosearch and filter for logs with Loki.

To configure the datasource via provisioning, see Configuring Grafana viaProvisioningin the Grafana documentation and make sure to adjust the URL similarly asshown above.