docs/sources/datasources/_index.md
A data source in Grafana is a connection to a storage backend that holds your data, such as a Prometheus server, a Loki instance, a SQL database, or a cloud monitoring service. Grafana queries data sources to retrieve the stored data (e.g. metrics, logs, traces, and profiles) that it then visualizes in dashboards and Explore.
Grafana comes with built-in support for many data sources. If you need other data sources, you can also install one of the many data source plugins. If the plugin you need doesn't exist, you can develop a custom plugin.
Each data source comes with a query editor, which formulates custom queries according to the source's structure. After you add and configure a data source, you can use it as an input for many operations, including:
This documentation describes how to manage data sources in general, and how to configure or query the built-in data sources.
For other available plugins, refer to the list of documented plugins or browse the Plugin catalog. To develop a custom plugin, refer to Create a data source plugin.
{{< admonition type="note" >}} Grafana Cloud includes pre-configured data sources for Prometheus, Loki, and Tempo, so you can start querying without additional setup. Refer to Grafana Cloud documentation for details. {{< /admonition >}}
Only users with the organization administrator role can add or remove data sources. To access data source management tools in Grafana as an administrator, navigate to Connections > Data sources in the left-side menu.
For details on data source management, including instructions on how to configure user permissions for queries, refer to the administration documentation.
By default, any user in an organization can query any data source in that organization. With Grafana Enterprise or Grafana Cloud, you can configure data source permissions to restrict query, edit, and admin access to specific users, teams, or roles. Refer to the data source management documentation for details.
Before you can create your first dashboard, you need to add your data source.
{{< admonition type="note" >}} Only users with the organization admin role can add data sources. {{< /admonition >}}
To add a data source:
You can mark one data source as the Default by toggling the option on its configuration page. The default data source is pre-selected when you create new panels, navigate to Explore, or create alert rules.
Each data source's query editor provides a customized user interface that helps you write queries that take advantage of its unique capabilities. You use a data source's query editor when you create queries in dashboard panels or Explore.
Because of the differences between query languages, each data source query editor looks and functions differently. Depending on your data source, the query editor might provide auto-completion features, metric names, variable suggestions, or a visual query-building interface.
For general information about querying in Grafana, and common options and user interface elements across all query editors, refer to Query and transform data.
You can define and manage data sources as code using the Grafana provisioning system. This lets you configure data sources through YAML files or Terraform instead of the Grafana UI, which is useful for automated deployments and version-controlled configuration.
For more information, refer to Provision data sources.
Grafana includes three special data sources:
A built-in data source that generates random walk data and can poll the TestData data source. Additionally, it can list files and get other data from a Grafana installation. This can be helpful for testing visualizations and running experiments.
An abstraction that lets you query multiple data sources in the same panel. When you select Mixed, you can then select a different data source for each new query that you add.
{{< docs/play title="Mixed Datasources Example" url="https://play.grafana.org/d/000000100/" >}}
A data source that uses the result set from another panel in the same dashboard. The dashboard data source can use data either directly from the selected panel or from annotations attached to the selected panel.
{{< docs/play title="Panel as a Data Source" url="https://play.grafana.org/d/ede8zps8ndb0gc/" >}}
Grafana ships with the following core data sources, organized by their primary use case.
You can add additional data sources as plugins (that aren't available in core Grafana), which you can install or create yourself.
To view available data source plugins, go to the plugin catalog and select the "Data sources" filter. For details about the plugin catalog, refer to Plugin management.
You can further filter the plugin catalog's results for data sources provided by the Grafana community, Grafana Labs, and partners. If you use Grafana Enterprise, you can also filter by Enterprise-supported plugins.
For more documentation on a specific data source plugin's features, including its query language and editor, refer to its plugin catalog page.
To build your own data source plugin, refer to the Build a data source plugin tutorial and Plugin tools.
Grafana lets you link related data across different data sources so you can jump from one signal to another during investigations. For example, you can navigate from a trace span to related logs, or from a log line to metrics for the same service.
You can set up these links in two ways:
If you run into issues with a data source, refer to Troubleshoot data sources for solutions to common problems like connection errors, authentication failures, and empty query results.
Each built-in data source also has its own troubleshooting page with guidance specific to that data source.
After you've configured a data source, you can: