Path

Welcome to the Grafana learning path that shows you how to connect Grafana Cloud to a Loki logging backend and query your logs.

Estimated time: 14 min

Connect to a Loki data source in Grafana Cloud

Welcome to the Grafana learning path that shows you how to connect Grafana Cloud to a Loki logging backend and query your logs.

Loki is Grafana Labs’ horizontally scalable, highly available log aggregation system, inspired by Prometheus. The Loki data source lets you query logs with LogQL, correlate logs with metrics and traces, and explore log data in Grafana dashboards and Explore.

This path teaches you how to add a Loki data source in Grafana Cloud, configure the connection URL and authentication, test the connection, and verify that logs flow through to Explore.

Here’s what to expect

When you complete this path, you’ll be able to:

  • Understand the value of centralized log aggregation for observability
  • Learn the advantages of using the Loki data source in Grafana Cloud
  • Gather the connection URL, credentials, and tenant ID for your Loki backend
  • Add and name a new Loki data source in Grafana Cloud
  • Configure the connection URL for your Loki environment
  • Select an authentication method and enter credentials
  • Save and test the connection to confirm Grafana can reach Loki
  • Verify log data with a LogQL query in Explore

Before you begin

Before you connect to a Loki data source, ensure you have:

  • A Grafana Cloud account. To create an account, refer to Grafana Cloud.
  • Administrator rights to your Grafana instance.
  • A Loki backend to connect to. This can be a self-managed Loki instance, a Grafana Enterprise Logs (GEL) cluster, or a Grafana Cloud Logs stack.
  • Network access between Grafana Cloud and your Loki backend. For self-managed Loki reachable only on a private network, you need a private data source connection (PDC).
  • An agent shipping logs to Loki. Refer to Send log data to Loki for self-managed Loki, or Collect logs with Grafana Alloy for Grafana Cloud.

Note: Grafana Cloud includes a pre-configured grafanacloud-<stack>-logs data source backed by Loki. Add a Loki data source manually when you need to connect to a self-managed Loki instance, a Grafana Enterprise Logs cluster, or require a custom configuration beyond the pre-configured data source.

Troubleshooting

If you get stuck, we’ve got your back! Where appropriate, troubleshooting information is just a click away.

More to explore

We understand you might want to explore other capabilities not strictly on this path. We’ll provide you opportunities where it makes sense.

Are you ready?