<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>InfluxDB data source on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/</link><description>Recent content in InfluxDB data source on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.0/datasources/influxdb/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure the InfluxDB data source</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/configure/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/configure/</guid><content><![CDATA[&lt;h1 id=&#34;configure-the-influxdb-data-source&#34;&gt;Configure the InfluxDB data source&lt;/h1&gt;
&lt;p&gt;This document explains how to configure the InfluxDB data source and describes the available configuration options.&lt;/p&gt;
&lt;h2 id=&#34;key-concepts&#34;&gt;Key concepts&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re new to InfluxDB, these terms are used throughout the configuration:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Term&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Bucket&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A named location in InfluxDB 2.x and 3.x where time-series data is stored, equivalent to a database in 1.x.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Organization&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An InfluxDB 2.x workspace that groups users, buckets, and dashboards.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;DBRP mapping&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Database and Retention Policy mapping that lets InfluxQL queries work against InfluxDB 2.x buckets.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Measurement&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A logical grouping of fields, tags, and timestamps in InfluxDB, similar to a table in a relational database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Retention policy&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An InfluxDB 1.x setting that defines how long data is kept before automatic deletion.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Token&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An authentication credential used to access the InfluxDB API in 2.x and 3.x.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To configure the InfluxDB data source, you must have the &lt;code&gt;Administrator&lt;/code&gt; role.&lt;/p&gt;
&lt;p&gt;InfluxData provides three query languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SQL&lt;/strong&gt; - Standard SQL query language for InfluxDB 3.x and newer cloud products (Cloud Serverless, Cloud Dedicated, Clustered). InfluxData recommends SQL for new deployments. It supports JOINs, subqueries, and standard SQL functions. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB SQL reference&lt;/a&gt; for the full list of supported statements, operators, and functions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;InfluxQL&lt;/strong&gt; - An SQL-like query language developed by InfluxData, available across all InfluxDB versions. InfluxQL doesn&amp;rsquo;t support advanced functions such as JOINs. Refer to the &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/influxql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxQL reference&lt;/a&gt; for details.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flux&lt;/strong&gt; - A functional data scripting language for InfluxDB 2.x. Flux is not supported on InfluxDB 3.x. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/get-started/query-influxdb/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Query InfluxDB with Flux&lt;/a&gt; for a basic guide.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;If you&amp;rsquo;re migrating from InfluxDB 1.x or 2.x to InfluxDB 3.x, InfluxData recommends adopting SQL as your query language. Refer to InfluxData&amp;rsquo;s &lt;a href=&#34;https://docs.influxdata.com/influxdb3/cloud-serverless/guides/migrate-data/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;migration guide&lt;/a&gt; for help transitioning your data and queries.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;If you&amp;rsquo;re unsure which InfluxDB product you&amp;rsquo;re using, refer to InfluxData&amp;rsquo;s &lt;a href=&#34;https://docs.influxdata.com/influxdb3/enterprise/visualize-data/grafana/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB product detection tool&lt;/a&gt; for guidance.&lt;/p&gt;
&lt;h2 id=&#34;add-the-influxdb-data-source&#34;&gt;Add the InfluxDB data source&lt;/h2&gt;
&lt;p&gt;Complete the following steps to set up a new InfluxDB data source:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Connections&lt;/strong&gt; in the left-side menu.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add new connection&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;InfluxDB&lt;/code&gt; in the search bar.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;InfluxDB&lt;/strong&gt; data source.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add new data source&lt;/strong&gt; in the upper right.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Grafana opens the &lt;strong&gt;Settings&lt;/strong&gt; tab where you configure the data source. A sidebar on the left displays navigation links to each configuration section:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;URL and authentication&lt;/li&gt;
&lt;li&gt;Database settings&lt;/li&gt;
&lt;li&gt;Private data source connect (optional, Grafana Cloud only)&lt;/li&gt;
&lt;li&gt;Save &amp;amp; test&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configuration-options&#34;&gt;Configuration options&lt;/h2&gt;
&lt;p&gt;The following sections describe the available configuration options.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/influxdb/influxdb-updated-ui-v12.3.png&#34;
  alt=&#34;InfluxDB data source configuration page showing the sidebar navigation and settings&#34; width=&#34;1278&#34;
     height=&#34;821&#34;/&gt;&lt;/p&gt;
&lt;p&gt;First, configure the name of your connection.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Name&lt;/strong&gt; - Sets the name you use to refer to the data source in panels and queries. Examples: &lt;code&gt;InfluxDB-InfluxQL&lt;/code&gt;, &lt;code&gt;InfluxDB_SQL&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Default&lt;/strong&gt; - Toggle to set as the default data source.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;url-and-authentication&#34;&gt;URL and authentication&lt;/h3&gt;
&lt;p&gt;Use these settings to specify the InfluxDB instance the data source connects to.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;URL&lt;/strong&gt; - The HTTP protocol, IP address, and port of your InfluxDB API. The InfluxDB default API port is &lt;code&gt;8086&lt;/code&gt;. When you enter a URL, Grafana attempts to auto-detect your InfluxDB product based on URL patterns. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb3/enterprise/visualize-data/grafana/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB detection&lt;/a&gt; for more information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Product&lt;/strong&gt; - Select the InfluxDB product you&amp;rsquo;re connecting to. The available query languages depend on your product selection.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Query language&lt;/strong&gt; - Select the query language for your InfluxDB instance. This determines the connection details needed in &lt;strong&gt;Database settings&lt;/strong&gt;. The available options are:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Flux&lt;/strong&gt; - Flux is a data scripting language developed by InfluxData that allows you to query, analyze, and act on data. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/get-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Get started with Flux&lt;/a&gt; for guidance on using Flux.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;InfluxQL&lt;/strong&gt; - SQL-like language for querying InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SQL&lt;/strong&gt; - Native SQL language starting with &lt;strong&gt;InfluxDB v3.0&lt;/strong&gt;. Refer to InfluxData&amp;rsquo;s &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;SQL reference documentation&lt;/a&gt; for a list of supported statements, operators, and functions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following table shows which query languages are available for each InfluxDB product:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Product&lt;/th&gt;
              &lt;th&gt;Supported query languages&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Cloud Dedicated&lt;/td&gt;
              &lt;td&gt;SQL, InfluxQL&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Cloud Serverless&lt;/td&gt;
              &lt;td&gt;SQL, InfluxQL, Flux&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Clustered&lt;/td&gt;
              &lt;td&gt;SQL, InfluxQL&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Enterprise 1.x&lt;/td&gt;
              &lt;td&gt;InfluxQL, Flux&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Enterprise 3.x&lt;/td&gt;
              &lt;td&gt;SQL, InfluxQL&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Cloud (TSM)&lt;/td&gt;
              &lt;td&gt;InfluxQL, Flux&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB Cloud 1&lt;/td&gt;
              &lt;td&gt;InfluxQL&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB OSS 1.x&lt;/td&gt;
              &lt;td&gt;InfluxQL, Flux&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB OSS 2.x&lt;/td&gt;
              &lt;td&gt;InfluxQL, Flux&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxDB OSS 3.x&lt;/td&gt;
              &lt;td&gt;SQL, InfluxQL&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;&lt;em&gt;For InfluxQL only.&lt;/em&gt; &lt;strong&gt;Database &#43; Retention Policy (DBRP) Mapping&lt;/strong&gt; must be configured before data can be queried for the following products: &lt;em&gt;InfluxDB OSS 1.x&lt;/em&gt;, &lt;em&gt;InfluxDB OSS 2.x&lt;/em&gt;, &lt;em&gt;InfluxDB Enterprise 1.x&lt;/em&gt;, &lt;em&gt;InfluxDB Cloud (TSM)&lt;/em&gt;, &lt;em&gt;InfluxDB Cloud Serverless&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/influxql/dbrp/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Manage DBRP Mappings&lt;/a&gt; for guidance on setting this up using the CLI or API.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h4 id=&#34;advanced-http-settings&#34;&gt;Advanced HTTP settings&lt;/h4&gt;
&lt;p&gt;Toggle &lt;strong&gt;Advanced HTTP Settings&lt;/strong&gt; to expand optional settings for more control over your data source.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Allowed cookies&lt;/strong&gt; - Defines which cookies are forwarded to the data source. All other cookies are deleted by default.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Timeout&lt;/strong&gt; - Set an HTTP request timeout in seconds.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Custom HTTP headers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;&#43; Add header&lt;/strong&gt; to add one or more HTTP headers. HTTP headers pass additional context and metadata about the request/response.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Header&lt;/strong&gt; - Add a custom HTTP header. Select an option from the drop-down. Allows custom headers to be passed based on the needs of your InfluxDB instance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Value&lt;/strong&gt; - The value for the header.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;auth-and-tlsssl-settings&#34;&gt;Auth and TLS/SSL settings&lt;/h4&gt;
&lt;p&gt;Toggle &lt;strong&gt;Auth and TLS/SSL Settings&lt;/strong&gt; to expand authentication and security options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No Authentication&lt;/strong&gt; - Make the data source available without authentication. Grafana recommends using some type of authentication method.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Basic auth&lt;/strong&gt; - The most common authentication method. Use your InfluxDB instance username and password to authenticate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Forward OAuth identity&lt;/strong&gt; - Forward the OAuth access token (and also the OIDC ID token if available) of the user querying the data source.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;With credentials&lt;/strong&gt; - Toggle to enable credentials such as cookies or auth headers to be sent with cross-site requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;TLS/SSL Certificates are encrypted and stored in the Grafana database.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;TLS client auth&lt;/strong&gt; - When enabled, add the &lt;code&gt;Server name&lt;/code&gt;, &lt;code&gt;Client cert&lt;/code&gt; and &lt;code&gt;Client key&lt;/code&gt;. The client provides a certificate that the server validates to establish the client&amp;rsquo;s trusted identity. The client key encrypts the data between client and server.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Server name&lt;/strong&gt; - Name of the server. Example: &lt;code&gt;server1.domain.com&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Client cert&lt;/strong&gt; - Add the client certificate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Client key&lt;/strong&gt; - Add the client key.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CA cert&lt;/strong&gt; - Authenticate with a CA certificate. When enabled, follow the instructions of your CA (Certificate Authority) to download the certificate file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Skip TLS verify&lt;/strong&gt; - Toggle to bypass TLS certificate validation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;database-settings&#34;&gt;Database settings&lt;/h3&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Setting the database for this data source &lt;strong&gt;does not deny access to other databases&lt;/strong&gt;. The InfluxDB query syntax allows switching the database in the query. For example: &lt;code&gt;SHOW MEASUREMENTS ON _internal&lt;/code&gt; or &lt;code&gt;SELECT * FROM &amp;quot;_internal&amp;quot;..&amp;quot;database&amp;quot; LIMIT 10&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To support data isolation and security, make sure appropriate permissions are configured in InfluxDB.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Use these settings to specify the InfluxDB database your data source connects to. The required fields vary based on the query language selected in &lt;strong&gt;URL and authentication&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The following table shows which fields are required for each query language:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;&lt;strong&gt;Setting&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Flux&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;InfluxQL&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;SQL&lt;/strong&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Organization&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Default Bucket&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;User&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Password&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Token&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;✓&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Organization&lt;/strong&gt; - Sets the &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2/admin/organizations/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB organization&lt;/a&gt; used for Flux queries. Also used for the &lt;code&gt;v.organization&lt;/code&gt; query macro.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Default Bucket&lt;/strong&gt; - The &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2/admin/buckets/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB bucket&lt;/a&gt; used for the &lt;code&gt;v.defaultBucket&lt;/code&gt; macro in Flux queries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Database&lt;/strong&gt; - Sets the database name to query. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2/admin/buckets/view-buckets/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;View buckets&lt;/a&gt; in InfluxData&amp;rsquo;s documentation on how to locate the list of available buckets and their corresponding IDs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User&lt;/strong&gt; - The username used to sign in to InfluxDB.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Password&lt;/strong&gt; - The password for the specified user. Used with InfluxQL queries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Token&lt;/strong&gt; - The authentication token used to query InfluxDB. Retrieve this from the &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2/admin/tokens/view-tokens/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Tokens page&lt;/a&gt; in the InfluxDB UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;For SQL&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Database&lt;/strong&gt; field maps to the InfluxDB 3.x database (equivalent to a bucket).&lt;/li&gt;
&lt;li&gt;Use a &lt;a href=&#34;https://docs.influxdata.com/influxdb3/cloud-serverless/admin/tokens/database/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;database token&lt;/a&gt; with read access to the target database. For InfluxDB Cloud Serverless and Cloud Dedicated, generate a token from the InfluxDB management console or CLI.&lt;/li&gt;
&lt;li&gt;SQL queries use the FlightSQL (gRPC) protocol. If your InfluxDB instance doesn&amp;rsquo;t use TLS, enable &lt;strong&gt;Insecure Connection&lt;/strong&gt; in &lt;strong&gt;Advanced Database Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;For Flux&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With InfluxDB 2.x products, use the &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2/admin/tokens/create-token/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB authentication token&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;For InfluxDB 1.8, the token is &lt;code&gt;username:password&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;advanced-database-settings&#34;&gt;Advanced database settings&lt;/h4&gt;
&lt;p&gt;Toggle &lt;strong&gt;Advanced Database Settings&lt;/strong&gt; to expand optional settings that give you more control over the query experience.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Max series&lt;/strong&gt; - Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is &lt;code&gt;1000&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;For Flux and InfluxQL&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Min time interval&lt;/strong&gt; - Sets the minimum time interval for auto group-by. Grafana recommends setting this to match the data write frequency. For example, if your data is written every minute, it&amp;rsquo;s recommended to set this interval to 1 minute, so that each group contains data from each new write. The default is &lt;code&gt;10s&lt;/code&gt;. Refer to &lt;a href=&#34;#min-time-interval&#34;&gt;Min time interval&lt;/a&gt; for format examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;For InfluxQL&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;HTTP method&lt;/strong&gt; - Sets the HTTP method used to query your data source. The POST method allows for larger queries that would return an error using the GET method. The default method is &lt;code&gt;POST&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Autocomplete range&lt;/strong&gt; - Sets a time range limit for the query editor autocomplete to reduce the execution time of tag filter queries. Tags not present within the defined time range are filtered out. For example, setting the value to &lt;code&gt;12h&lt;/code&gt; includes only tag keys and values from the past 12 hours. This feature is recommended for very large databases, where significant performance improvements can be observed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;For SQL&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Insecure Connection&lt;/strong&gt; - Toggle to disable gRPC TLS security.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;private-data-source-connect&#34;&gt;Private data source connect&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;For Grafana Cloud only.&lt;/em&gt; Private data source connect (PDC) allows you to establish a private, secured connection between a Grafana Cloud instance and data sources secured within a private network. For more information, refer to &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/&#34;&gt;Private data source connect (PDC)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Manage private data source connect&lt;/strong&gt; to go to your PDC connection page, where you&amp;rsquo;ll find your PDC configuration details.&lt;/p&gt;
&lt;h3 id=&#34;save-and-test&#34;&gt;Save and test&lt;/h3&gt;
&lt;p&gt;After you have configured your connection settings, click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to validate the data source connection.&lt;/p&gt;
&lt;p&gt;A successful test returns one of the following messages depending on your query language:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Query language&lt;/th&gt;
              &lt;th&gt;Success message&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Flux&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;datasource is working. X buckets found&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxQL&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;datasource is working. X measurements found&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;SQL&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;OK&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;If the test fails, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/troubleshooting/&#34;&gt;Troubleshoot InfluxDB data source issues&lt;/a&gt; for help resolving common connection and authentication errors.&lt;/p&gt;
&lt;h3 id=&#34;min-time-interval&#34;&gt;Min time interval&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Min time interval&lt;/strong&gt; setting defines a lower limit for the auto group-by time interval.&lt;/p&gt;
&lt;p&gt;This value &lt;strong&gt;must be&lt;/strong&gt; formatted as a number followed by a valid time identifier:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Identifier&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;y&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;year&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;M&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;month&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;w&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;week&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;d&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;day&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;h&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;hour&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;m&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;minute&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;s&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;second&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ms&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;millisecond&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can also override this setting in a dashboard panel under its data source options.&lt;/p&gt;
&lt;h2 id=&#34;provision-the-influxdb-data-source&#34;&gt;Provision the InfluxDB data source&lt;/h2&gt;
&lt;p&gt;You can define and configure the data source in YAML files as part of the Grafana provisioning system.
For more information about provisioning, and for available configuration options, refer
to 
    &lt;a href=&#34;/docs/grafana/v13.0/administration/provisioning/#provision-grafana&#34;&gt;Provision Grafana&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The &lt;code&gt;database&lt;/code&gt; &lt;a href=&#34;https://github.com/grafana/grafana/pull/58647&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;field is deprecated&lt;/a&gt;.
Grafana recommends using the &lt;code&gt;dbName&lt;/code&gt; field in &lt;code&gt;jsonData&lt;/code&gt;. There is no need to change existing provisioning settings.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;provisioning-examples&#34;&gt;Provisioning examples&lt;/h3&gt;
&lt;p&gt;Provisioning differs based on query language.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 1.x example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: InfluxDB_v1
    type: influxdb
    access: proxy
    user: grafana
    url: http://localhost:8086
    jsonData:
      dbName: site
      httpMode: GET
    secureJsonData:
      password: grafana&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 2.x for Flux example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: InfluxDB_v2_Flux
    type: influxdb
    access: proxy
    url: http://localhost:8086
    jsonData:
      version: Flux
      organization: organization
      defaultBucket: bucket
      tlsSkipVerify: true
    secureJsonData:
      token: token&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 2.x for InfluxQL example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: InfluxDB_v2_InfluxQL
    type: influxdb
    access: proxy
    url: http://localhost:8086
    jsonData:
      dbName: site
      httpHeaderName1: &amp;#39;Authorization&amp;#39;
    secureJsonData:
      httpHeaderValue1: &amp;#39;Token &amp;lt;token&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 3.x for SQL example:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: 1

datasources:
  - name: InfluxDB_v3_SQL
    type: influxdb
    access: proxy
    url: http://localhost:8086
    jsonData:
      version: SQL
      dbName: site
      httpMode: POST
      insecureGrpc: false
    secureJsonData:
      token: &amp;#39;&amp;lt;api-token&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configure-the-data-source-with-terraform&#34;&gt;Configure the data source with Terraform&lt;/h2&gt;
&lt;p&gt;You can configure the InfluxDB data source using the &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Terraform provider&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;terraform-prerequisites&#34;&gt;Terraform prerequisites&lt;/h3&gt;
&lt;p&gt;Before you begin, you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.terraform.io/downloads&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Terraform&lt;/a&gt; installed&lt;/li&gt;
&lt;li&gt;Grafana Terraform provider configured with appropriate credentials&lt;/li&gt;
&lt;li&gt;For Grafana Cloud: A &lt;a href=&#34;/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/&#34;&gt;Cloud Access Policy token&lt;/a&gt; with data source permissions&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;provider-configuration&#34;&gt;Provider configuration&lt;/h3&gt;
&lt;p&gt;Configure the Grafana provider to connect to your Grafana instance:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;terraform {
  required_providers {
    grafana = {
      source  = &amp;#34;grafana/grafana&amp;#34;
      version = &amp;#34;&amp;gt;= 2.0.0&amp;#34;
    }
  }
}

# For Grafana Cloud
provider &amp;#34;grafana&amp;#34; {
  url  = &amp;#34;&amp;lt;YOUR_GRAFANA_CLOUD_STACK_URL&amp;gt;&amp;#34;
  auth = &amp;#34;&amp;lt;YOUR_SERVICE_ACCOUNT_TOKEN&amp;gt;&amp;#34;
}

# For self-hosted Grafana
# provider &amp;#34;grafana&amp;#34; {
#   url  = &amp;#34;http://localhost:3000&amp;#34;
#   auth = &amp;#34;&amp;lt;API_KEY_OR_SERVICE_ACCOUNT_TOKEN&amp;gt;&amp;#34;
# }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;terraform-examples&#34;&gt;Terraform examples&lt;/h3&gt;
&lt;p&gt;The following examples show how to configure the InfluxDB data source for each query language.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 2.x with Flux:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;influxdb_flux&amp;#34; {
  type = &amp;#34;influxdb&amp;#34;
  name = &amp;#34;InfluxDB_Flux&amp;#34;
  url  = &amp;#34;http://localhost:8086&amp;#34;

  json_data_encoded = jsonencode({
    version       = &amp;#34;Flux&amp;#34;
    organization  = &amp;#34;&amp;lt;ORGANIZATION&amp;gt;&amp;#34;
    defaultBucket = &amp;#34;&amp;lt;DEFAULT_BUCKET&amp;gt;&amp;#34;
    tlsSkipVerify = false
  })

  secure_json_data_encoded = jsonencode({
    token = &amp;#34;&amp;lt;API_TOKEN&amp;gt;&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 1.x with InfluxQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;influxdb_influxql&amp;#34; {
  type = &amp;#34;influxdb&amp;#34;
  name = &amp;#34;InfluxDB_InfluxQL&amp;#34;
  url  = &amp;#34;http://localhost:8086&amp;#34;

  basic_auth_enabled  = true
  basic_auth_username = &amp;#34;&amp;lt;USERNAME&amp;gt;&amp;#34;

  json_data_encoded = jsonencode({
    dbName   = &amp;#34;&amp;lt;DATABASE&amp;gt;&amp;#34;
    httpMode = &amp;#34;POST&amp;#34;
  })

  secure_json_data_encoded = jsonencode({
    basicAuthPassword = &amp;#34;&amp;lt;PASSWORD&amp;gt;&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 2.x with InfluxQL (token auth):&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;influxdb_v2_influxql&amp;#34; {
  type = &amp;#34;influxdb&amp;#34;
  name = &amp;#34;InfluxDB_v2_InfluxQL&amp;#34;
  url  = &amp;#34;http://localhost:8086&amp;#34;

  json_data_encoded = jsonencode({
    dbName          = &amp;#34;&amp;lt;DATABASE&amp;gt;&amp;#34;
    httpHeaderName1 = &amp;#34;Authorization&amp;#34;
  })

  secure_json_data_encoded = jsonencode({
    httpHeaderValue1 = &amp;#34;Token &amp;lt;API_TOKEN&amp;gt;&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;InfluxDB 3.x with SQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;hcl&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-hcl&#34;&gt;resource &amp;#34;grafana_data_source&amp;#34; &amp;#34;influxdb_sql&amp;#34; {
  type = &amp;#34;influxdb&amp;#34;
  name = &amp;#34;InfluxDB_SQL&amp;#34;
  url  = &amp;#34;http://localhost:8086&amp;#34;

  json_data_encoded = jsonencode({
    version      = &amp;#34;SQL&amp;#34;
    dbName       = &amp;#34;&amp;lt;DATABASE&amp;gt;&amp;#34;
    httpMode     = &amp;#34;POST&amp;#34;
    insecureGrpc = false
  })

  secure_json_data_encoded = jsonencode({
    token = &amp;#34;&amp;lt;API_TOKEN&amp;gt;&amp;#34;
  })
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information about the Grafana Terraform provider, refer to the &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/data_source&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Terraform provider documentation&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="configure-the-influxdb-data-source">Configure the InfluxDB data source&lt;/h1>
&lt;p>This document explains how to configure the InfluxDB data source and describes the available configuration options.&lt;/p>
&lt;h2 id="key-concepts">Key concepts&lt;/h2>
&lt;p>If you&amp;rsquo;re new to InfluxDB, these terms are used throughout the configuration:&lt;/p></description></item><item><title>InfluxDB query editor</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/query-editor/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/query-editor/</guid><content><![CDATA[&lt;h1 id=&#34;influxdb-query-editor&#34;&gt;InfluxDB query editor&lt;/h1&gt;
&lt;p&gt;The InfluxDB query editor helps you build and run queries against your InfluxDB data source. You can access it from the 
    &lt;a href=&#34;/docs/grafana/v13.0/explore/&#34;&gt;Explore page&lt;/a&gt; or from any dashboard panel by clicking the ellipsis in the upper right of the panel and selecting &lt;strong&gt;Edit&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The editor supports three query languages — SQL, InfluxQL, and Flux — each with its own editing experience and macro system. SQL and InfluxQL provide both a visual builder mode and a code editing mode, while Flux provides a code editor only. You can also use the query editor to retrieve &lt;a href=&#34;#query-logs&#34;&gt;log data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For general information about Grafana query editors, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/panels-visualizations/query-transform-data/&#34;&gt;Query and transform data&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ensure you have 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/configure/&#34;&gt;configured the InfluxDB data source&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Verify your credentials have appropriate permissions to query the target database or bucket.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;key-concepts&#34;&gt;Key concepts&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re new to InfluxDB, these terms are used throughout the query editor:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Term&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Measurement&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A logical grouping of fields, tags, and timestamps, similar to a table in a relational database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Field&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A column in a measurement that stores the actual data values (numbers, strings, Boolean values).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Tag&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;A column used for metadata and indexing. Tags are indexed and optimized for filtering.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Retention policy&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An InfluxDB 1.x setting that controls how long data is stored before automatic deletion.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Bucket&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;An InfluxDB 2.x and 3.x storage location that combines a database and retention policy.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;choose-a-query-editor&#34;&gt;Choose a query editor&lt;/h2&gt;
&lt;p&gt;The InfluxDB data source has three query editors, each corresponding to the query language selected in the 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/configure/&#34;&gt;data source configuration&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#influxql-query-editor&#34;&gt;InfluxQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#sql-query-editor&#34;&gt;SQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#flux-query-editor&#34;&gt;Flux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Editor options vary based on query language.&lt;/p&gt;
&lt;h2 id=&#34;influxql-query-editor&#34;&gt;InfluxQL query editor&lt;/h2&gt;
&lt;p&gt;The InfluxQL query editor helps you select metrics and tags to create InfluxQL queries. There are two modes: &lt;code&gt;visual editor mode&lt;/code&gt; and &lt;code&gt;raw query mode&lt;/code&gt;. To switch between the two modes click the &lt;strong&gt;pencil icon&lt;/strong&gt; in the upper right.&lt;/p&gt;
&lt;p&gt;Visual query editor mode contains the following components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FROM&lt;/strong&gt; - Select a measurement to query.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WHERE&lt;/strong&gt; - Select filters by clicking the &lt;strong&gt;&#43; sign&lt;/strong&gt;. You can enter regular expressions or use the text input for regular expression tag values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SELECT&lt;/strong&gt; - Select fields and functions from the drop-down. You can add multiple fields and functions by clicking the &lt;strong&gt;&#43; sign&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GROUP BY&lt;/strong&gt; - Select a tag from the drop-down menu.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TIMEZONE&lt;/strong&gt; - &lt;em&gt;Optional&lt;/em&gt; Group data by a specific timezone.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ORDER BY TIME&lt;/strong&gt; - Sort data by time in either ascending or descending order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LIMIT&lt;/strong&gt; - &lt;em&gt;Optional&lt;/em&gt; Limits the number of rows returned by the query.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SLIMIT&lt;/strong&gt; - &lt;em&gt;Optional&lt;/em&gt; Limits the number of series returned by the query. Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/influxql/explore-data/limit-and-slimit/#slimit-clause&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;SLIMIT clause&lt;/a&gt; for more information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;FORMAT AS&lt;/strong&gt; - Select a format option from the drop-down menu: time series, table, or logs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ALIAS&lt;/strong&gt; - Add an alias. Refer to &lt;a href=&#34;#alias-patterns&#34;&gt;Alias patterns&lt;/a&gt; for more information.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;raw-query-editor-mode&#34;&gt;Raw query editor mode&lt;/h3&gt;
&lt;p&gt;You can write raw InfluxQL queries by switching to raw query mode. Click the pencil in the upper right of the query editor to switch modes. When you switch to visual editor mode, any changes made in raw query mode are lost.&lt;/p&gt;
&lt;p&gt;If you use raw query mode, your query must include &lt;code&gt;WHERE $timeFilter&lt;/code&gt;. You should also provide a group by time and an aggregation function. Otherwise, InfluxDB may return hundreds of thousands of data points, potentially causing your browser to hang.&lt;/p&gt;
&lt;h3 id=&#34;match-by-regular-expressions&#34;&gt;Match by regular expressions&lt;/h3&gt;
&lt;p&gt;You can enter regular expressions for metric names or tag filter values.
Wrap the regular expression pattern in forward slashes (&lt;code&gt;/&lt;/code&gt;), as shown in this example: &lt;code&gt;/measurement/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Grafana automatically adjusts the filter tag condition to use the InfluxDB regular expression match condition operator (&lt;code&gt;=~&lt;/code&gt;).&lt;/p&gt;
&lt;h3 id=&#34;field-and-aggregation-functions&#34;&gt;Field and aggregation functions&lt;/h3&gt;
&lt;p&gt;In the &lt;code&gt;SELECT&lt;/code&gt; row, you can specify which fields and functions to use.&lt;/p&gt;
&lt;p&gt;If you &lt;strong&gt;group by time&lt;/strong&gt; you must use an aggregation function. Certain functions such as &lt;code&gt;derivative&lt;/code&gt; also require an aggregation function.&lt;/p&gt;
&lt;p&gt;The query editor input generates an InfluxDB &lt;code&gt;SELECT&lt;/code&gt; clause. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT derivative(mean(&amp;#34;value&amp;#34;), 10s) / 10 AS &amp;#34;REQ/s&amp;#34;
FROM....&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also use a * in a SELECT statement to select all fields.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM &amp;lt;measurement_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;group-by-results&#34;&gt;GROUP BY results&lt;/h3&gt;
&lt;p&gt;To group results by a tag, specify the tag in the &lt;strong&gt;GROUP BY&lt;/strong&gt; row:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;&#43; sign&lt;/strong&gt; in the GROUP BY row.&lt;/li&gt;
&lt;li&gt;Select a tag from the drop-down.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can GROUP BY multiple options.&lt;/p&gt;
&lt;p&gt;To remove a GROUP BY option click the &lt;strong&gt;X icon&lt;/strong&gt; next to the option.&lt;/p&gt;
&lt;h3 id=&#34;alias-patterns&#34;&gt;Alias patterns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Alias pattern&lt;/th&gt;
              &lt;th&gt;Replaced with&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$m&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Measurement name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$measurement&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Measurement name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$1&lt;/code&gt; - &lt;code&gt;$9&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Part of measurement name (if you separate your measurement name with dots).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$col&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Column name.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$tag_exampletag&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The value of the &lt;code&gt;exampletag&lt;/code&gt; tag. The syntax is &lt;code&gt;$tag_yourTagName&lt;/code&gt; and must start with &lt;code&gt;$tag_&lt;/code&gt;. To use your tag as an alias in the ALIAS BY field, you must use the tag to group by in the query.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can also use the &lt;code&gt;[[tag_hostname]]&lt;/code&gt; pattern replacement syntax.&lt;/p&gt;
&lt;p&gt;For example, entering the value &lt;code&gt;Host: [[tag_hostname]]&lt;/code&gt; in the ALIAS BY field replaces it with the &lt;code&gt;hostname&lt;/code&gt; tag value for each legend value.&lt;/p&gt;
&lt;p&gt;An example legend value is &lt;code&gt;Host: server1&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;sql-query-editor&#34;&gt;SQL query editor&lt;/h2&gt;
&lt;p&gt;Grafana supports the &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/query-data/sql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;SQL query language&lt;/a&gt; for InfluxDB 3.x and newer cloud products (Cloud Serverless, Cloud Dedicated, Clustered). SQL is InfluxData&amp;rsquo;s recommended query language for new deployments.&lt;/p&gt;
&lt;p&gt;The SQL query editor provides two modes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Builder mode&lt;/strong&gt; - A visual query builder that helps you construct SQL queries by selecting tables, columns, filters, and aggregations from drop-down menus. This mode is useful for building queries without writing SQL directly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Code mode&lt;/strong&gt; - A text editor for writing raw SQL queries with autocomplete and syntax highlighting. Switch between modes using the toggle at the top of the query editor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;SQL queries connect to InfluxDB using the FlightSQL (gRPC) protocol, which provides high-performance data transfer for large result sets.&lt;/p&gt;
&lt;h3 id=&#34;format-output&#34;&gt;Format output&lt;/h3&gt;
&lt;p&gt;The SQL query editor supports two output formats:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Time series&lt;/strong&gt; (default) - Returns data as time-series frames. The query must include a timestamp column.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Table&lt;/strong&gt; - Returns data as a table frame, useful for non-time-series queries or when you want to display raw results.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Select the format from the &lt;strong&gt;Format&lt;/strong&gt; drop-down in the query editor.&lt;/p&gt;
&lt;h3 id=&#34;macros&#34;&gt;Macros&lt;/h3&gt;
&lt;p&gt;You can use macros in your query to automatically substitute them with values from the Grafana context.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Macro example&lt;/th&gt;
              &lt;th&gt;Replaced with&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__timeFrom&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The start of the currently active time selection, such as &lt;code&gt;cast(&#39;2020-06-11T13:31:00Z&#39; as timestamp)&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__timeTo&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The end of the currently active time selection, such as &lt;code&gt;cast(&#39;2020-06-11T14:31:00Z&#39; as timestamp)&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__timeFilter(&amp;lt;column&amp;gt;)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A time range filter applied to the specified column. Expands to &lt;code&gt;&amp;lt;column&amp;gt; &amp;gt;= $__timeFrom AND &amp;lt;column&amp;gt; &amp;lt;= $__timeTo&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;An interval string that corresponds to the Grafana calculated interval based on the time range of the active time selection, such as &lt;code&gt;interval &#39;5 second&#39;&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__dateBin(&amp;lt;column&amp;gt;)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Applies the &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/functions/time-and-date/#date_bin&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;date_bin&lt;/code&gt;&lt;/a&gt; function using &lt;code&gt;$__interval&lt;/code&gt;. Column must be a timestamp.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__dateBinAlias(&amp;lt;column&amp;gt;)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Applies the &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/functions/time-and-date/#date_bin&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;date_bin&lt;/code&gt;&lt;/a&gt; function with a &lt;code&gt;_binned&lt;/code&gt; suffix alias. Column must be a timestamp.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__timeGroup(&amp;lt;column&amp;gt;)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Groups results by a time interval using &lt;code&gt;date_bin()&lt;/code&gt; with &lt;code&gt;$__interval&lt;/code&gt;. Column must be a timestamp.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;$__timeGroupAlias(&amp;lt;column&amp;gt;)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Groups results by a time interval using &lt;code&gt;date_bin()&lt;/code&gt; with &lt;code&gt;$__interval&lt;/code&gt; and adds a &lt;code&gt;_binned&lt;/code&gt; suffix alias. Column must be a timestamp.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;sql-query-examples&#34;&gt;SQL query examples&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Basic time-series query:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT time, usage_system, usage_user
FROM cpu
WHERE $__timeFilter(time)
ORDER BY time&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Aggregated time-series query with date_bin:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT
  $__dateBin(time) AS time,
  mean(usage_system) AS avg_system,
  mean(usage_user) AS avg_user
FROM cpu
WHERE $__timeFilter(time)
GROUP BY $__dateBin(time)
ORDER BY time&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Using JOINs across tables:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SQL supports JOINs, which aren&amp;rsquo;t available in InfluxQL or Flux:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT
  c.time,
  c.usage_system,
  m.used_percent AS mem_used
FROM cpu c
INNER JOIN mem m ON c.time = m.time AND c.host = m.host
WHERE $__timeFilter(c.time)
ORDER BY c.time&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Filtering with WHERE clauses:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT $__dateBin(time) AS time, mean(usage_system) AS avg_system
FROM cpu
WHERE $__timeFilter(time)
  AND host = &amp;#39;server01&amp;#39;
  AND cpu = &amp;#39;cpu-total&amp;#39;
GROUP BY $__dateBin(time)
ORDER BY time&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For the full list of supported SQL statements, operators, and functions, refer to InfluxData&amp;rsquo;s &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;SQL reference documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;flux-query-editor&#34;&gt;Flux query editor&lt;/h2&gt;
&lt;p&gt;Grafana supports Flux when running InfluxDB v1.8 and higher.
If your data source is 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/configure/&#34;&gt;configured for Flux&lt;/a&gt;, you can use
the &lt;a href=&#34;https://docs.influxdata.com/flux/v0/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Flux&lt;/a&gt; in the query editor, which serves as
a text editor for raw Flux queries with macro support.&lt;/p&gt;
&lt;p&gt;For more information and connection details, refer
to &lt;a href=&#34;https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB 1.8 API compatibility&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;use-macros&#34;&gt;Use macros&lt;/h3&gt;
&lt;p&gt;You can enter macros in the query to replace them with values from the Grafana context.&lt;/p&gt;
&lt;!-- vale Grafana.Spelling = NO --&gt;
&lt;p&gt;Macros support copying and pasting from &lt;a href=&#34;https://www.influxdata.com/time-series-platform/chronograf/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxData Chronograf&lt;/a&gt;.&lt;/p&gt;
&lt;!-- vale Grafana.Spelling = YES --&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Macro example&lt;/th&gt;
              &lt;th&gt;Replaced with&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;v.timeRangeStart&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The start of the currently active time selection, such as &lt;code&gt;2020-06-11T13:31:00Z&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;v.timeRangeStop&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The end of the currently active time selection, such as &lt;code&gt;2020-06-11T14:31:00Z&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;v.windowPeriod&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;An interval string compatible with Flux that corresponds to the Grafana calculated interval based on the time range of the active time selection, such as &lt;code&gt;5s&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;v.defaultBucket&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;strong&gt;Default Bucket&lt;/strong&gt; value from the data source configuration.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;v.organization&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The data source configuration&amp;rsquo;s &lt;strong&gt;Organization&lt;/strong&gt; setting.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For example, consider the following Flux query:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;from(bucket: v.defaultBucket)
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_measurement&amp;#34;] == &amp;#34;cpu&amp;#34; or r[&amp;#34;_measurement&amp;#34;] == &amp;#34;swap&amp;#34;)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_field&amp;#34;] == &amp;#34;usage_system&amp;#34; or r[&amp;#34;_field&amp;#34;] == &amp;#34;free&amp;#34;)
  |&amp;gt; aggregateWindow(every: v.windowPeriod, fn: mean)
  |&amp;gt; yield(name: &amp;#34;mean&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana interpolates this Flux query into the following and sends it to InfluxDB, with the interval and time period values changing according to the active time selection:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;from(bucket: &amp;#34;grafana&amp;#34;)
  |&amp;gt; range(start: 2020-06-11T13:59:07Z, stop: 2020-06-11T14:59:07Z)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_measurement&amp;#34;] == &amp;#34;cpu&amp;#34; or r[&amp;#34;_measurement&amp;#34;] == &amp;#34;swap&amp;#34;)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_field&amp;#34;] == &amp;#34;usage_system&amp;#34; or r[&amp;#34;_field&amp;#34;] == &amp;#34;free&amp;#34;)
  |&amp;gt; aggregateWindow(every: 2s, fn: mean)
  |&amp;gt; yield(name: &amp;#34;mean&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To view the interpolated version of a query with the Query inspector, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/panels-visualizations/panel-inspector/&#34;&gt;Panel Inspector&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;query-logs&#34;&gt;Query logs&lt;/h2&gt;
&lt;p&gt;You can query and display log data from InfluxDB in 
    &lt;a href=&#34;/docs/grafana/v13.0/explore/&#34;&gt;Explore&lt;/a&gt; and in the dashboard 
    &lt;a href=&#34;/docs/grafana/v13.0/panels-visualizations/visualizations/logs/&#34;&gt;Logs panel&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;InfluxQL:&lt;/strong&gt; Select an InfluxDB data source in the query editor. Under the &lt;strong&gt;Select measurement field&lt;/strong&gt; next to the &lt;strong&gt;FROM&lt;/strong&gt; section, choose a measurement containing your log data, then choose the appropriate fields that will display the log message. Add any additional filters by clicking the &lt;strong&gt;&#43; sign&lt;/strong&gt; next to the &lt;strong&gt;WHERE&lt;/strong&gt; field. Set &lt;strong&gt;FORMAT AS&lt;/strong&gt; to &lt;strong&gt;Logs&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SQL:&lt;/strong&gt; Write a SQL query that returns a timestamp column and a text column containing the log message. Set the &lt;strong&gt;Format&lt;/strong&gt; to &lt;strong&gt;Table&lt;/strong&gt;. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT time, message, level, host
FROM syslog
WHERE $__timeFilter(time)
ORDER BY time DESC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Flux:&lt;/strong&gt; Use a Flux query with the &lt;code&gt;_value&lt;/code&gt; field containing the log message.&lt;/p&gt;
&lt;p&gt;After InfluxDB returns the results, the log panel displays log rows along with a bar chart. The x-axis represents time, while the y-axis shows the frequency or count.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/template-variables/&#34;&gt;Use template variables&lt;/a&gt; for dynamic dashboards.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/annotations/&#34;&gt;Set up annotations&lt;/a&gt; to overlay events on your graphs.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/alerting/&#34;&gt;Create alert rules&lt;/a&gt; based on your InfluxDB queries.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="influxdb-query-editor">InfluxDB query editor&lt;/h1>
&lt;p>The InfluxDB query editor helps you build and run queries against your InfluxDB data source. You can access it from the
&lt;a href="/docs/grafana/v13.0/explore/">Explore page&lt;/a> or from any dashboard panel by clicking the ellipsis in the upper right of the panel and selecting &lt;strong>Edit&lt;/strong>.&lt;/p></description></item><item><title>InfluxDB template variables</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/template-variables/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/template-variables/</guid><content><![CDATA[&lt;h1 id=&#34;influxdb-template-variables&#34;&gt;InfluxDB template variables&lt;/h1&gt;
&lt;p&gt;Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana displays these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.&lt;/p&gt;
&lt;p&gt;For general information about variables, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/&#34;&gt;Variables&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/add-template-variables/&#34;&gt;Add and manage variables&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/configure/&#34;&gt;Configure the InfluxDB data source&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Understand 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/&#34;&gt;Grafana template variables&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;supported-variable-types&#34;&gt;Supported variable types&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Variable type&lt;/th&gt;
              &lt;th&gt;Supported&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Query&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Custom&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Data source&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Ad-hoc filter&lt;/td&gt;
              &lt;td&gt;Yes (InfluxQL only)&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;create-a-query-variable&#34;&gt;Create a query variable&lt;/h2&gt;
&lt;p&gt;By adding a query template variable, you can write an InfluxDB metadata exploration query. These queries return results such as measurement names, key names, and key values.&lt;/p&gt;
&lt;p&gt;For more information, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/add-template-variables/#add-a-query-variable&#34;&gt;Add a query variable&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;influxql-query-variable-examples&#34;&gt;InfluxQL query variable examples&lt;/h3&gt;
&lt;p&gt;To create a variable containing all values for the &lt;code&gt;hostname&lt;/code&gt; tag, use the following query in the &lt;strong&gt;Query&lt;/strong&gt; field:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can fetch key names for a given measurement:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW TAG KEYS [FROM &amp;lt;measurement_name&amp;gt;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can list available measurements:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW MEASUREMENTS&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;flux-query-variable-examples&#34;&gt;Flux query variable examples&lt;/h3&gt;
&lt;p&gt;For Flux-configured data sources, write a Flux query that returns a single column of values:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;import &amp;#34;influxdata/influxdb/schema&amp;#34;
schema.tagValues(bucket: v.defaultBucket, tag: &amp;#34;hostname&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;sql-query-variable-examples&#34;&gt;SQL query variable examples&lt;/h3&gt;
&lt;p&gt;For SQL-configured data sources (InfluxDB 3.x), write an SQL query that returns a single column of values:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT DISTINCT hostname FROM cpu&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can list available tables:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW TABLES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can list columns in a specific table:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW COLUMNS FROM cpu&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;chain-or-nest-variables&#34;&gt;Chain or nest variables&lt;/h2&gt;
&lt;p&gt;You can create nested variables, sometimes called 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/add-template-variables/#chained-variables&#34;&gt;chained variables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, if you have a variable named &lt;code&gt;region&lt;/code&gt;, you can configure the &lt;code&gt;hosts&lt;/code&gt; variable to display only hosts from the selected region.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;InfluxQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34;  WHERE region = &amp;#39;$region&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;SQL:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT DISTINCT hostname FROM cpu WHERE region = &amp;#39;$region&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you have a variable containing key names, you can use it in a &lt;strong&gt;GROUP BY&lt;/strong&gt; clause. This allows you to adjust the grouping by selecting from the variable list at the top of the dashboard.&lt;/p&gt;
&lt;h2 id=&#34;use-ad-hoc-filters&#34;&gt;Use &lt;strong&gt;Ad hoc filters&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;InfluxDB supports the &lt;strong&gt;Ad hoc filters&lt;/strong&gt; variable type for InfluxQL. This variable type allows you to define multiple key/value filters, which Grafana automatically applies to all your InfluxDB queries. &lt;strong&gt;Ad hoc filters&lt;/strong&gt; also support expressions.&lt;/p&gt;
&lt;p&gt;To add &lt;strong&gt;Ad hoc filters&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Dashboard settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Variables&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add variable&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Ad hoc filters&lt;/strong&gt; as the variable type.&lt;/li&gt;
&lt;li&gt;Select your InfluxDB data source.&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- vale Grafana.Spelling = NO --&gt;
&lt;p&gt;For more information, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/variables/add-template-variables/#add-ad-hoc-filters&#34;&gt;Add free-form filters&lt;/a&gt;.&lt;/p&gt;
&lt;!-- vale Grafana.Spelling = YES --&gt;
&lt;h2 id=&#34;choose-a-variable-syntax&#34;&gt;Choose a variable syntax&lt;/h2&gt;
&lt;p&gt;The InfluxDB data source supports two variable syntaxes for use in the &lt;strong&gt;Query&lt;/strong&gt; field:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;$&amp;lt;varname&amp;gt;&lt;/code&gt;&lt;/strong&gt; - Use this syntax for standalone variable references. It doesn&amp;rsquo;t allow you to use a variable in the middle of a word or expression.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;${varname}&lt;/code&gt;&lt;/strong&gt; - Use this syntax when you want to interpolate a variable in the middle of an expression.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;InfluxQL examples:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT mean(&amp;#34;value&amp;#34;) FROM &amp;#34;logins&amp;#34; WHERE &amp;#34;hostname&amp;#34; =~ /^$host$/ AND $timeFilter GROUP BY time($__interval), &amp;#34;hostname&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT mean(&amp;#34;value&amp;#34;) FROM &amp;#34;logins&amp;#34; WHERE &amp;#34;hostname&amp;#34; =~ /^${host}$/ AND $timeFilter GROUP BY time($__interval), &amp;#34;hostname&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When you enable the &lt;strong&gt;Multi-value&lt;/strong&gt; or &lt;strong&gt;Include all value&lt;/strong&gt; options with InfluxQL, Grafana converts the labels from plain text to a regular expression-compatible string, so you must use &lt;code&gt;=~&lt;/code&gt; instead of &lt;code&gt;=&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SQL examples:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT $__dateBin(time), mean(usage_system) FROM cpu WHERE $__timeFilter(time) AND host = &amp;#39;$host&amp;#39; GROUP BY $__dateBin(time)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT $__dateBin(time), mean(usage_system) FROM cpu WHERE $__timeFilter(time) AND host IN ($host) GROUP BY $__dateBin(time)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;When you enable the &lt;strong&gt;Multi-value&lt;/strong&gt; option with SQL, use the &lt;code&gt;IN&lt;/code&gt; operator instead of &lt;code&gt;=&lt;/code&gt; to match multiple values.&lt;/p&gt;
&lt;h3 id=&#34;templated-dashboard-example&#34;&gt;Templated dashboard example&lt;/h3&gt;
&lt;p&gt;To view an example of a templated dashboard, refer to this &lt;a href=&#34;https://play.grafana.org/d/f62a0410-5abb-4dd8-9dfc-caddfc3e2ffd/eccb2445-b0a2-5e83-8e0f-6d5ea53ad575&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB example dashboard&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="influxdb-template-variables">InfluxDB template variables&lt;/h1>
&lt;p>Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana displays these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables.&lt;/p></description></item><item><title>InfluxDB annotations</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/annotations/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/annotations/</guid><content><![CDATA[&lt;h1 id=&#34;influxdb-annotations&#34;&gt;InfluxDB annotations&lt;/h1&gt;
&lt;p&gt;Annotations overlay event data on your dashboard graphs, helping you correlate events with metrics. You can use InfluxDB as a data source for annotations to display events such as deployments, alerts, or other significant occurrences on your visualizations.&lt;/p&gt;
&lt;p&gt;For general information about annotations, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/dashboards/build-dashboards/annotate-visualizations/&#34;&gt;Annotate visualizations&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before creating InfluxDB annotations, ensure you have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An InfluxDB data source configured in Grafana&lt;/li&gt;
&lt;li&gt;Data in InfluxDB containing event information with timestamp fields&lt;/li&gt;
&lt;li&gt;Read access to the InfluxDB database or bucket containing your events&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;create-an-annotation-query&#34;&gt;Create an annotation query&lt;/h2&gt;
&lt;p&gt;To add an InfluxDB annotation to your dashboard:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to your dashboard and click &lt;strong&gt;Dashboard settings&lt;/strong&gt; (gear icon).&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Annotations&lt;/strong&gt; in the left menu.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add annotation query&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;Name&lt;/strong&gt; for the annotation.&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;InfluxDB&lt;/strong&gt; data source from the &lt;strong&gt;Data source&lt;/strong&gt; drop-down.&lt;/li&gt;
&lt;li&gt;Configure the annotation query and field mappings.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save dashboard&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;influxql-annotations&#34;&gt;InfluxQL annotations&lt;/h2&gt;
&lt;p&gt;For InfluxQL-configured data sources, write an InfluxQL query in the &lt;strong&gt;InfluxQL Query&lt;/strong&gt; field. Your query &lt;strong&gt;must&lt;/strong&gt; include &lt;code&gt;WHERE $timeFilter&lt;/code&gt; to scope the results to the dashboard&amp;rsquo;s time range.&lt;/p&gt;
&lt;h3 id=&#34;field-mappings&#34;&gt;Field mappings&lt;/h3&gt;
&lt;p&gt;Field mappings tell Grafana which InfluxDB columns contain the annotation data. If your query returns only one column, you don&amp;rsquo;t need to enter anything in the field mapping fields.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Text&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The column containing the annotation description displayed when you hover over the annotation.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Tags&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The column containing tags for the annotation. The value can be a comma-separated string. Tags help categorize and filter annotations.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;TimeEnd&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;The column containing an end time for range annotations. Range annotations display as a shaded region on the graph instead of a single vertical line.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;influxql-annotation-query-example&#34;&gt;InfluxQL annotation query example&lt;/h3&gt;
&lt;p&gt;The following query retrieves deployment events and displays them as annotations:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT title, description
FROM events
WHERE $timeFilter
ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;range-annotation-example&#34;&gt;Range annotation example&lt;/h3&gt;
&lt;p&gt;To display events with duration as shaded regions:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT description, tags, end_time
FROM maintenance_windows
WHERE $timeFilter
ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Configure the field mappings as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Text:&lt;/strong&gt; &lt;code&gt;description&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;tags&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TimeEnd:&lt;/strong&gt; &lt;code&gt;end_time&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;flux-annotations&#34;&gt;Flux annotations&lt;/h2&gt;
&lt;p&gt;For Flux-configured data sources, annotations use the standard Flux query editor. Write a Flux query that returns data frames with time, text, and optional tag fields.&lt;/p&gt;
&lt;h3 id=&#34;flux-annotation-query-example&#34;&gt;Flux annotation query example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;from(bucket: &amp;#34;events&amp;#34;)
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_measurement&amp;#34;] == &amp;#34;deployments&amp;#34;)
  |&amp;gt; pivot(rowKey: [&amp;#34;_time&amp;#34;], columnKey: [&amp;#34;_field&amp;#34;], valueColumn: &amp;#34;_value&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana processes the resulting data frames as annotation events. Ensure the query returns a &lt;code&gt;_time&lt;/code&gt; column and at least one text column.&lt;/p&gt;
&lt;h2 id=&#34;sql-annotations&#34;&gt;SQL annotations&lt;/h2&gt;
&lt;p&gt;SQL-configured data sources (InfluxDB 3.x) use the standard Grafana annotation query editor. Write an SQL query that returns a time column and at least one text column. Use the &lt;code&gt;$__timeFilter(time)&lt;/code&gt; macro to scope results to the dashboard time range.&lt;/p&gt;
&lt;h3 id=&#34;sql-annotation-query-example&#34;&gt;SQL annotation query example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT time, title, description
FROM events
WHERE $__timeFilter(time)
ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;sql-range-annotation-example&#34;&gt;SQL range annotation example&lt;/h3&gt;
&lt;p&gt;To display events with duration as shaded regions, return both a start time and an end time:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT time, end_time, description, tags
FROM maintenance_windows
WHERE $__timeFilter(time)
ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Configure the field mappings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Text:&lt;/strong&gt; &lt;code&gt;description&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;tags&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TimeEnd:&lt;/strong&gt; &lt;code&gt;end_time&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;use-template-variables-in-annotations&#34;&gt;Use template variables in annotations&lt;/h2&gt;
&lt;p&gt;You can use template variables in your annotation queries to filter annotations based on dashboard variable selections. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT title, description
FROM events
WHERE $timeFilter AND environment = &amp;#39;$environment&amp;#39;
ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If your annotations aren&amp;rsquo;t appearing or you encounter errors, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/troubleshooting/#annotation-errors&#34;&gt;Troubleshoot InfluxDB data source issues&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="influxdb-annotations">InfluxDB annotations&lt;/h1>
&lt;p>Annotations overlay event data on your dashboard graphs, helping you correlate events with metrics. You can use InfluxDB as a data source for annotations to display events such as deployments, alerts, or other significant occurrences on your visualizations.&lt;/p></description></item><item><title>InfluxDB alerting</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/alerting/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/alerting/</guid><content><![CDATA[&lt;h1 id=&#34;influxdb-alerting&#34;&gt;InfluxDB alerting&lt;/h1&gt;
&lt;p&gt;You can use Grafana Alerting with InfluxDB to create alerts based on your time-series data. This allows you to monitor metrics, detect anomalies, and receive notifications when specific conditions are met.&lt;/p&gt;
&lt;p&gt;For general information about Grafana Alerting, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/alerting/&#34;&gt;Grafana Alerting&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before creating alerts with InfluxDB, ensure you have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An InfluxDB data source configured in Grafana&lt;/li&gt;
&lt;li&gt;Appropriate permissions to create alert rules&lt;/li&gt;
&lt;li&gt;Understanding of the metrics you want to monitor&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;supported-query-types&#34;&gt;Supported query types&lt;/h2&gt;
&lt;p&gt;InfluxDB alerting supports all three query languages: InfluxQL, SQL, and Flux. Queries must return time-series data for Grafana to evaluate values over time and trigger alerts when thresholds are crossed.&lt;/p&gt;
&lt;h3 id=&#34;query-language-compatibility&#34;&gt;Query language compatibility&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Query language&lt;/th&gt;
              &lt;th&gt;Alerting support&lt;/th&gt;
              &lt;th&gt;Notes&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;InfluxQL&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;Use aggregation functions with GROUP BY time.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Flux&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;Use &lt;code&gt;aggregateWindow()&lt;/code&gt; for time-based aggregation.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;SQL&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;Use &lt;code&gt;$__timeFilter&lt;/code&gt; and &lt;code&gt;$__dateBin&lt;/code&gt; macros for time filtering.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;create-an-alert-rule&#34;&gt;Create an alert rule&lt;/h2&gt;
&lt;p&gt;To create an alert rule using InfluxDB:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Alerting&lt;/strong&gt; &amp;gt; &lt;strong&gt;Alert rules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New alert rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a name for the alert rule.&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;InfluxDB&lt;/strong&gt; data source.&lt;/li&gt;
&lt;li&gt;Build your query using the query editor.&lt;/li&gt;
&lt;li&gt;Configure the alert condition (for example, when the average is above a threshold).&lt;/li&gt;
&lt;li&gt;Set the evaluation interval and pending period.&lt;/li&gt;
&lt;li&gt;Configure notifications and labels.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save rule&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For detailed instructions, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/alerting/alerting-rules/create-grafana-managed-rule/&#34;&gt;Create a Grafana-managed alert rule&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;example-alert-queries&#34;&gt;Example alert queries&lt;/h2&gt;
&lt;p&gt;The following examples show common alerting scenarios with InfluxDB.&lt;/p&gt;
&lt;h3 id=&#34;influxql-alert-on-high-cpu-usage&#34;&gt;InfluxQL: Alert on high CPU usage&lt;/h3&gt;
&lt;p&gt;Monitor CPU usage and alert when it exceeds a threshold:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Query:&lt;/strong&gt; Select the &lt;code&gt;cpu&lt;/code&gt; measurement with &lt;code&gt;mean(&amp;quot;usage_system&amp;quot;)&lt;/code&gt; as the aggregation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GROUP BY:&lt;/strong&gt; &lt;code&gt;time($__interval)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Condition:&lt;/strong&gt; When mean is above 90.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In raw query mode:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT mean(&amp;#34;usage_system&amp;#34;) FROM &amp;#34;cpu&amp;#34; WHERE $timeFilter GROUP BY time($__interval) fill(null)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;flux-alert-on-memory-pressure&#34;&gt;Flux: Alert on memory pressure&lt;/h3&gt;
&lt;p&gt;Monitor memory usage with a Flux query:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;from(bucket: &amp;#34;telegraf&amp;#34;)
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_measurement&amp;#34;] == &amp;#34;mem&amp;#34;)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_field&amp;#34;] == &amp;#34;used_percent&amp;#34;)
  |&amp;gt; aggregateWindow(every: v.windowPeriod, fn: mean)
  |&amp;gt; yield(name: &amp;#34;mean&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Set the condition to alert when the mean value exceeds 85.&lt;/p&gt;
&lt;h3 id=&#34;sql-alert-on-disk-usage&#34;&gt;SQL: Alert on disk usage&lt;/h3&gt;
&lt;p&gt;Monitor disk usage with an SQL query:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT $__dateBin(time), mean(used_percent)
FROM disk
WHERE $__timeFilter(time)
GROUP BY $__dateBin(time)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Set the condition to alert when the mean value exceeds 80.&lt;/p&gt;
&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;
&lt;p&gt;When using InfluxDB with Grafana Alerting, be aware of the following limitations:&lt;/p&gt;
&lt;h3 id=&#34;template-variables-not-supported&#34;&gt;Template variables not supported&lt;/h3&gt;
&lt;p&gt;Alert queries can&amp;rsquo;t contain template variables. Grafana evaluates alert rules on the backend without dashboard context, so variables like &lt;code&gt;$hostname&lt;/code&gt; or &lt;code&gt;$region&lt;/code&gt; aren&amp;rsquo;t resolved.&lt;/p&gt;
&lt;p&gt;If your dashboard query uses template variables, create a separate query for alerting with hard-coded values.&lt;/p&gt;
&lt;h3 id=&#34;query-complexity&#34;&gt;Query complexity&lt;/h3&gt;
&lt;p&gt;Complex queries with many nested functions or large result sets may timeout or fail to evaluate. Simplify queries for alerting by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reducing the time range&lt;/li&gt;
&lt;li&gt;Using appropriate aggregation intervals&lt;/li&gt;
&lt;li&gt;Adding filters to limit the data scanned&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;best-practices&#34;&gt;Best practices&lt;/h2&gt;
&lt;p&gt;Follow these best practices when creating InfluxDB alerts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use specific filters:&lt;/strong&gt; Add WHERE clauses or Flux filters to focus on relevant data and improve query performance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Choose appropriate intervals:&lt;/strong&gt; Match the GROUP BY time interval to your evaluation frequency.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Test queries first:&lt;/strong&gt; Verify your query returns expected results in Explore before creating an alert.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Set realistic thresholds:&lt;/strong&gt; Base alert thresholds on historical data patterns.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use meaningful names:&lt;/strong&gt; Give alert rules descriptive names that indicate what they monitor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you encounter errors when creating or evaluating alert rules, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/troubleshooting/#alerting-errors&#34;&gt;Troubleshoot InfluxDB data source issues&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="influxdb-alerting">InfluxDB alerting&lt;/h1>
&lt;p>You can use Grafana Alerting with InfluxDB to create alerts based on your time-series data. This allows you to monitor metrics, detect anomalies, and receive notifications when specific conditions are met.&lt;/p></description></item><item><title>Troubleshoot InfluxDB data source issues</title><link>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/troubleshooting/</link><pubDate>Thu, 07 May 2026 15:16:15 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/datasources/influxdb/troubleshooting/</guid><content><![CDATA[&lt;h1 id=&#34;troubleshoot-influxdb-data-source-issues&#34;&gt;Troubleshoot InfluxDB data source issues&lt;/h1&gt;
&lt;p&gt;This document provides solutions to common issues you may encounter when configuring or using the InfluxDB data source. Issues are organized to follow the typical setup and usage workflow. For configuration instructions, refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/datasources/influxdb/configure/&#34;&gt;Configure the InfluxDB data source&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;connection-errors&#34;&gt;Connection errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when Grafana can&amp;rsquo;t establish or maintain a connection to InfluxDB.&lt;/p&gt;
&lt;h3 id=&#34;plugin-health-check-failed-or-an-error-occurred-within-the-plugin&#34;&gt;&amp;ldquo;Plugin health check failed&amp;rdquo; or &amp;ldquo;An error occurred within the plugin&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All panels using InfluxDB return &amp;ldquo;An error occurred within the plugin&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Adding a new InfluxDB data source fails with &amp;ldquo;Plugin health check failed&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Connection settings appear blank in the UI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Platform outage&lt;/td&gt;
              &lt;td&gt;If all InfluxDB panels fail at the same time, check the &lt;a href=&#34;https://status.grafana.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Cloud status page&lt;/a&gt; for active incidents before investigating your own configuration. The issue may be a transient platform problem that resolves without customer-side action.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Authentication failure&lt;/td&gt;
              &lt;td&gt;Check the Grafana server logs for auth-related errors. Verify your credentials haven&amp;rsquo;t expired or been rotated.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Transient network issue&lt;/td&gt;
              &lt;td&gt;The error may self-resolve. Wait a few minutes and retry &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt;. If the issue persists, check network connectivity between Grafana and InfluxDB.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;failed-to-connect-to-influxdb&#34;&gt;Failed to connect to InfluxDB&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;error performing influxQL query&lt;/code&gt; or &lt;code&gt;error performing flux query&lt;/code&gt; or &lt;code&gt;error performing sql query&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Grafana can&amp;rsquo;t establish a network connection to the InfluxDB server.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify that the InfluxDB URL is correct in the data source configuration.&lt;/li&gt;
&lt;li&gt;Check that InfluxDB is running and accessible from the Grafana server.&lt;/li&gt;
&lt;li&gt;Ensure the URL includes the protocol (&lt;code&gt;http://&lt;/code&gt; or &lt;code&gt;https://&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Verify the port is correct (the InfluxDB default API port is &lt;code&gt;8086&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Ensure there are no firewall rules blocking the connection.&lt;/li&gt;
&lt;li&gt;For Grafana Cloud, ensure you have configured &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/&#34;&gt;Private data source connect&lt;/a&gt; if your InfluxDB instance is not publicly accessible.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;pdc-connection-fails-with-no-such-host&#34;&gt;PDC connection fails with &amp;ldquo;no such host&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;socks connect tcp ... -&amp;gt; influxdb.host:8086: dial tcp: lookup ... no such host&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; When using &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/&#34;&gt;Private data source connect (PDC)&lt;/a&gt;, the InfluxDB URL can&amp;rsquo;t be resolved through the SOCKS proxy tunnel.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Don&amp;rsquo;t use &lt;code&gt;127.0.0.1&lt;/code&gt; or &lt;code&gt;localhost&lt;/code&gt; as the InfluxDB URL. PDC tunnels traffic over a SOCKS proxy, which can&amp;rsquo;t resolve loopback addresses.&lt;/li&gt;
&lt;li&gt;Use the machine&amp;rsquo;s LAN IP address or a resolvable hostname instead.&lt;/li&gt;
&lt;li&gt;Verify the hostname is resolvable from the network where the PDC agent is running.&lt;/li&gt;
&lt;li&gt;If the error appeared suddenly without configuration changes, check the &lt;a href=&#34;https://status.grafana.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Cloud status page&lt;/a&gt; for active incidents.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;request-timed-out&#34;&gt;Request timed out&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;context deadline exceeded&lt;/code&gt; or &lt;code&gt;request timeout&lt;/code&gt; or &lt;code&gt;dial tcp &amp;lt;IP&amp;gt;:&amp;lt;port&amp;gt;: i/o timeout&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The connection to InfluxDB timed out before receiving a response. This is common after Grafana upgrades when infrastructure changes (such as database host migrations) happen at the same time.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify network connectivity from the Grafana server to your InfluxDB endpoint. Check DNS resolution, firewall rules, and port access.&lt;/li&gt;
&lt;li&gt;Confirm the InfluxDB host IP address or hostname hasn&amp;rsquo;t changed. This is especially important after infrastructure migrations or Grafana upgrades.&lt;/li&gt;
&lt;li&gt;Check the network latency between Grafana and InfluxDB.&lt;/li&gt;
&lt;li&gt;Verify that InfluxDB is not overloaded or experiencing performance issues.&lt;/li&gt;
&lt;li&gt;Increase the timeout setting in the data source configuration under &lt;strong&gt;Advanced HTTP Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Reduce the time range or complexity of your query.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;authentication-errors&#34;&gt;Authentication errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when there are issues with authentication credentials or permissions.&lt;/p&gt;
&lt;h3 id=&#34;unauthorized-401&#34;&gt;Unauthorized (401)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;401 Unauthorized&amp;rdquo; or &amp;ldquo;authorization failed&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The authentication credentials are invalid or missing.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify that the token or password is correct in the data source configuration.&lt;/li&gt;
&lt;li&gt;For Flux and SQL, ensure the token has not expired.&lt;/li&gt;
&lt;li&gt;For InfluxQL with InfluxDB 2.x, verify the token is set as an &lt;code&gt;Authorization&lt;/code&gt; header with the value &lt;code&gt;Token &amp;lt;your-token&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For InfluxDB 1.x, verify the username and password are correct.&lt;/li&gt;
&lt;li&gt;Check that the token has the required permissions to access the specified bucket or database.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;forbidden-403&#34;&gt;Forbidden (403)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;403 Forbidden&amp;rdquo; or &amp;ldquo;access denied&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The authenticated user or token doesn&amp;rsquo;t have permission to access the requested resource.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the token has read access to the specified bucket or database.&lt;/li&gt;
&lt;li&gt;Check the token&amp;rsquo;s permissions in the InfluxDB UI under &lt;strong&gt;API Tokens&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the organization ID is correct for Flux queries.&lt;/li&gt;
&lt;li&gt;For InfluxQL with InfluxDB 2.x, verify the DBRP mapping is configured correctly.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;configuration-errors&#34;&gt;Configuration errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when the data source is not configured correctly.&lt;/p&gt;
&lt;h3 id=&#34;url-not-configured&#34;&gt;URL not configured&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;missing URL from datasource configuration&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The data source URL field is empty.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the data source configuration in Grafana.&lt;/li&gt;
&lt;li&gt;Enter the full URL of your InfluxDB instance in the &lt;strong&gt;URL&lt;/strong&gt; field, including the protocol and port (for example, &lt;code&gt;http://localhost:8086&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to verify the connection.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;unknown-influx-version&#34;&gt;Unknown influx version&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;unknown influx version&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query language is not properly configured in the data source settings.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the data source configuration in Grafana.&lt;/li&gt;
&lt;li&gt;Verify that a valid query language is selected: &lt;strong&gt;Flux&lt;/strong&gt;, &lt;strong&gt;InfluxQL&lt;/strong&gt;, or &lt;strong&gt;SQL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Match the query language to your InfluxDB version:&lt;/li&gt;
&lt;/ol&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;InfluxDB version&lt;/th&gt;
              &lt;th&gt;Recommended query language&lt;/th&gt;
              &lt;th&gt;Notes&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;1.x&lt;/td&gt;
              &lt;td&gt;InfluxQL&lt;/td&gt;
              &lt;td&gt;Flux is available from 1.8&#43; but InfluxQL is the primary language.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;2.x (OSS/Cloud)&lt;/td&gt;
              &lt;td&gt;Flux&lt;/td&gt;
              &lt;td&gt;InfluxQL is also available via the v1 compatibility API, but requires &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/influxql/dbrp/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;DBRP mapping&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;3.x / Cloud Dedicated / Cloud Serverless&lt;/td&gt;
              &lt;td&gt;SQL or InfluxQL&lt;/td&gt;
              &lt;td&gt;Flux is not supported on InfluxDB 3.x.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Each query language uses a different API endpoint. If you select the wrong language for your InfluxDB version, health checks and queries fail.&lt;/p&gt;
&lt;h3 id=&#34;invalid-data-source-info-received&#34;&gt;Invalid data source info received&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;invalid data source info received&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The data source configuration is incomplete or corrupted.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Delete and recreate the data source.&lt;/li&gt;
&lt;li&gt;Ensure all required fields are populated based on your query language:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Flux:&lt;/strong&gt; URL, Organization, Token, Default Bucket&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;InfluxQL:&lt;/strong&gt; URL, Database, User, Password&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SQL:&lt;/strong&gt; URL, Database, Token&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;dbrp-mapping-required&#34;&gt;DBRP mapping required&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;database not found&amp;rdquo; or queries return no data with InfluxQL on InfluxDB 2.x&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; InfluxQL queries on InfluxDB 2.x require a Database and Retention Policy (DBRP) mapping.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a DBRP mapping in InfluxDB using the CLI or API.&lt;/li&gt;
&lt;li&gt;Refer to &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud/query-data/influxql/dbrp/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Manage DBRP Mappings&lt;/a&gt; for guidance.&lt;/li&gt;
&lt;li&gt;Verify the database name in Grafana matches the DBRP mapping.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;browser-access-mode-disabled&#34;&gt;Browser access mode disabled&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;Direct browser access in the InfluxDB datasource is no longer available. Switch to server access mode.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The data source is configured for direct browser access, which is no longer supported.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the data source configuration in Grafana.&lt;/li&gt;
&lt;li&gt;Change the access mode to &lt;strong&gt;Server (default)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to verify the connection.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;content-security-policy-csp-violation&#34;&gt;Content Security Policy (CSP) violation&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CSP violation errors in the browser console referencing the InfluxDB plugin&lt;/li&gt;
&lt;li&gt;&lt;code&gt;net::ERR_ABORTED&lt;/code&gt; on proxy requests&lt;/li&gt;
&lt;li&gt;The InfluxDB plugin attempts direct browser-to-InfluxDB connections&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; You&amp;rsquo;re running an outdated version of Grafana. Browser access mode was removed in Grafana 9.2.0, and older versions may attempt direct browser connections that violate CSP policies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Upgrade to the latest stable Grafana release. The InfluxDB data source requires Grafana 12.3.0 or later.&lt;/li&gt;
&lt;li&gt;After upgrading, verify the data source access mode is set to &lt;strong&gt;Server (default)&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;health-check-errors&#34;&gt;Health check errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when clicking &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to validate the data source connection. Each query language uses a different health check query.&lt;/p&gt;
&lt;h3 id=&#34;flux-health-check-errors&#34;&gt;Flux health check errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error performing flux query&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The health check query &lt;code&gt;buckets()&lt;/code&gt; failed to execute.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the InfluxDB URL is correct and reachable.&lt;/li&gt;
&lt;li&gt;Check that the token is valid and has not expired.&lt;/li&gt;
&lt;li&gt;Ensure the organization ID is correct.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error reading buckets&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;buckets()&lt;/code&gt; query executed but returned an error.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the token has permission to list buckets.&lt;/li&gt;
&lt;li&gt;Check that the organization ID matches the token&amp;rsquo;s organization.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error getting flux query buckets&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;buckets()&lt;/code&gt; query executed without error but returned no data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the token has permission to list buckets.&lt;/li&gt;
&lt;li&gt;Check that the organization ID is correct.&lt;/li&gt;
&lt;li&gt;Ensure InfluxDB is running and accessible.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;influxql-health-check-errors&#34;&gt;InfluxQL health check errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error performing influxQL query&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The health check query &lt;code&gt;SHOW MEASUREMENTS&lt;/code&gt; failed to execute.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the InfluxDB URL is correct and reachable.&lt;/li&gt;
&lt;li&gt;Check the username and password (or token for InfluxDB 2.x).&lt;/li&gt;
&lt;li&gt;Verify the database name exists.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error reading influxDB&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The &lt;code&gt;SHOW MEASUREMENTS&lt;/code&gt; query executed but returned an error.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the database name is correct.&lt;/li&gt;
&lt;li&gt;Check that the user has permission to run &lt;code&gt;SHOW MEASUREMENTS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For InfluxDB 2.x, verify DBRP mapping is configured.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error connecting InfluxDB influxQL&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The health check completed but the response couldn&amp;rsquo;t be processed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the database name is correct.&lt;/li&gt;
&lt;li&gt;Check that the user has permission to run &lt;code&gt;SHOW MEASUREMENTS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the database exists and contains measurements.&lt;/li&gt;
&lt;li&gt;For InfluxDB 2.x, verify DBRP mapping is configured.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;sql-health-check-errors&#34;&gt;SQL health check errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;error performing sql query&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The health check query &lt;code&gt;select 1&lt;/code&gt; failed to execute against the FlightSQL endpoint.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the InfluxDB URL is correct. The SQL health check connects via gRPC (FlightSQL).&lt;/li&gt;
&lt;li&gt;Check the token is valid and has the required permissions.&lt;/li&gt;
&lt;li&gt;If using TLS, verify the certificate configuration. Toggle &lt;strong&gt;Insecure Connection&lt;/strong&gt; if connecting without TLS.&lt;/li&gt;
&lt;li&gt;Ensure the InfluxDB 3.x instance is running and the FlightSQL endpoint is accessible.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;0-measurements-found&#34;&gt;0 measurements found&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &lt;code&gt;datasource is working. 0 measurements found&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The connection is successful, but the database contains no measurements.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify you are connecting to the correct database.&lt;/li&gt;
&lt;li&gt;Check that data has been written to the database.&lt;/li&gt;
&lt;li&gt;If the database is new, add some test data to verify the connection.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;query-errors&#34;&gt;Query errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when there are issues with query syntax or execution.&lt;/p&gt;
&lt;h3 id=&#34;query-syntax-error&#34;&gt;Query syntax error&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;error parsing query: found THING&amp;rdquo; or &amp;ldquo;failed to parse query: found WERE, expected ; at line 1, char 38&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query contains invalid syntax.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Check your query syntax for typos or invalid keywords.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For InfluxQL, verify the query follows the correct syntax:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT &amp;lt;field&amp;gt; FROM &amp;lt;measurement&amp;gt; WHERE &amp;lt;condition&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For SQL, verify your query uses standard SQL syntax supported by InfluxDB 3.x. Common issues include using InfluxQL-specific syntax (such as &lt;code&gt;GROUP BY time()&lt;/code&gt;) in SQL mode. Refer to the &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB SQL reference&lt;/a&gt; for supported functions.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For Flux, ensure proper pipe-forward syntax and function calls.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the InfluxDB UI or CLI to test your query directly.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;query-timeout-limit-exceeded&#34;&gt;Query timeout limit exceeded&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;query-timeout limit exceeded&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query took longer than the configured timeout limit in InfluxDB.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce the time range of your query.&lt;/li&gt;
&lt;li&gt;Add more specific filters to limit the data scanned.&lt;/li&gt;
&lt;li&gt;Increase the query timeout setting in InfluxDB if you have administrator access.&lt;/li&gt;
&lt;li&gt;Optimize your query to reduce complexity.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;too-many-series-or-data-points&#34;&gt;Too many series or data points&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;max-series-per-database limit exceeded&amp;rdquo; or &amp;ldquo;A query returned too many data points and the results have been truncated&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query is returning more data than the configured limits allow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce the time range of your query.&lt;/li&gt;
&lt;li&gt;Add filters to limit the number of series returned.&lt;/li&gt;
&lt;li&gt;Increase the &lt;strong&gt;Max series&lt;/strong&gt; setting in the data source configuration under &lt;strong&gt;Advanced Database Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Use aggregation functions to reduce the number of data points.&lt;/li&gt;
&lt;li&gt;For SQL, use &lt;code&gt;$__dateBin(time)&lt;/code&gt; to aggregate data into time buckets and reduce cardinality.&lt;/li&gt;
&lt;li&gt;For Flux, use &lt;code&gt;aggregateWindow()&lt;/code&gt; to downsample data.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;flightsql-errors-sql-query-language&#34;&gt;FlightSQL errors (SQL query language)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; Messages prefixed with &lt;code&gt;&amp;quot;flightsql: &amp;quot;&lt;/code&gt; followed by a gRPC error description.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The SQL (FlightSQL) backend encountered an error communicating with InfluxDB 3.x.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Possible causes and solutions:&lt;/strong&gt;&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Error code&lt;/th&gt;
              &lt;th&gt;Cause&lt;/th&gt;
              &lt;th&gt;Solution&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;InvalidArgument&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The SQL query syntax is invalid.&lt;/td&gt;
              &lt;td&gt;Check your SQL query for syntax errors.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;PermissionDenied&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The token doesn&amp;rsquo;t have access to the requested resource.&lt;/td&gt;
              &lt;td&gt;Verify the token has read access to the database.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;NotFound&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The requested table or database doesn&amp;rsquo;t exist.&lt;/td&gt;
              &lt;td&gt;Check the database name and table name in your query.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Unavailable&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The InfluxDB server is unreachable.&lt;/td&gt;
              &lt;td&gt;Verify InfluxDB is running and the URL is correct.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Unauthenticated&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The token is missing, invalid, or expired.&lt;/td&gt;
              &lt;td&gt;Update the token in the data source configuration.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;no-time-column-found&#34;&gt;No time column found&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;no time column found&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query result doesn&amp;rsquo;t include a time column, which is required for time-series visualization.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure your query includes a time field.&lt;/li&gt;
&lt;li&gt;For Flux, verify the query includes &lt;code&gt;_time&lt;/code&gt; in the output.&lt;/li&gt;
&lt;li&gt;For SQL, ensure the query returns a timestamp column.&lt;/li&gt;
&lt;li&gt;Check that the time field is not being filtered out or excluded.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;annotation-errors&#34;&gt;Annotation errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when using InfluxDB annotations on dashboards.&lt;/p&gt;
&lt;h3 id=&#34;query-missing-in-annotation-definition&#34;&gt;&amp;ldquo;Query missing in annotation definition&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The annotation query field is empty.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Navigate to &lt;strong&gt;Dashboard settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Annotations&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the InfluxDB annotation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a valid query in the &lt;strong&gt;InfluxQL Query&lt;/strong&gt; field. The query must include &lt;code&gt;WHERE $timeFilter&lt;/code&gt;. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;SQL&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT title, description FROM events WHERE $timeFilter ORDER BY time ASC&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;flux-requires-the-standard-annotation-query&#34;&gt;&amp;ldquo;Flux requires the standard annotation query&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; A Flux data source is using the legacy InfluxQL annotation editor instead of the standard Flux query editor.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Delete the existing annotation query.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new annotation query and select your Flux-configured InfluxDB data source.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Write a Flux query that returns data frames with time and text fields. For example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;flux&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-flux&#34;&gt;from(bucket: &amp;#34;events&amp;#34;)
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r[&amp;#34;_measurement&amp;#34;] == &amp;#34;deployments&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;annotations-dont-appear-on-the-graph&#34;&gt;Annotations don&amp;rsquo;t appear on the graph&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Annotations are configured but aren&amp;rsquo;t visible on the dashboard.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the annotation query returns data by testing it in Explore.&lt;/li&gt;
&lt;li&gt;Check the dashboard time range covers the time period of your annotation events.&lt;/li&gt;
&lt;li&gt;Ensure the annotation toggle is enabled in the dashboard (check the annotation icon in the top menu bar).&lt;/li&gt;
&lt;li&gt;For InfluxQL, confirm the query includes &lt;code&gt;WHERE $timeFilter&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If your query returns multiple columns, verify the field mappings (&lt;strong&gt;Text&lt;/strong&gt;, &lt;strong&gt;Tags&lt;/strong&gt;, &lt;strong&gt;TimeEnd&lt;/strong&gt;) are set correctly.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;alerting-errors&#34;&gt;Alerting errors&lt;/h2&gt;
&lt;p&gt;The following errors occur when using InfluxDB queries with Grafana Alerting.&lt;/p&gt;
&lt;h3 id=&#34;alert-rule-fails-with-template-variable-errors&#34;&gt;Alert rule fails with template variable errors&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The alert query contains template variables such as &lt;code&gt;$hostname&lt;/code&gt; or &lt;code&gt;$region&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Alert queries can&amp;rsquo;t use template variables because Grafana evaluates alert rules on the backend without dashboard context. Replace template variables with hard-coded values:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the alert rule.&lt;/li&gt;
&lt;li&gt;Replace any &lt;code&gt;$variable&lt;/code&gt; references with literal values.&lt;/li&gt;
&lt;li&gt;Save the alert rule.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you need the same query in both a dashboard panel and an alert rule, maintain two separate queries: one with variables for the dashboard and one with hard-coded values for alerting.&lt;/p&gt;
&lt;h3 id=&#34;alert-evaluation-returns-no-data&#34;&gt;Alert evaluation returns &amp;ldquo;no data&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The alert query doesn&amp;rsquo;t return time-series data that Grafana can evaluate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Test the query in Explore first to verify it returns data.&lt;/li&gt;
&lt;li&gt;For InfluxQL, ensure the query uses an aggregation function (such as &lt;code&gt;mean&lt;/code&gt;, &lt;code&gt;sum&lt;/code&gt;, &lt;code&gt;count&lt;/code&gt;) with &lt;code&gt;GROUP BY time($__interval)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For Flux, use &lt;code&gt;aggregateWindow()&lt;/code&gt; to produce time-bucketed results.&lt;/li&gt;
&lt;li&gt;For SQL, use &lt;code&gt;$__dateBin(time)&lt;/code&gt; or &lt;code&gt;$__timeGroup(time)&lt;/code&gt; to aggregate by time.&lt;/li&gt;
&lt;li&gt;Check that the alert evaluation time range contains data. Alerts use a fixed time range, not the dashboard&amp;rsquo;s time picker.&lt;/li&gt;
&lt;li&gt;Verify the data source connection is working by clicking &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; in the data source settings.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;other-common-issues&#34;&gt;Other common issues&lt;/h2&gt;
&lt;p&gt;The following issues don&amp;rsquo;t produce specific error messages but are commonly encountered during day-to-day use.&lt;/p&gt;
&lt;h3 id=&#34;data-source-was-not-found&#34;&gt;&amp;ldquo;Data source was not found&amp;rdquo;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Symptoms:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dashboard panels display &amp;ldquo;data source &amp;lt;UID&amp;gt; was not found&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Manually re-running queries in the panel editor works after you select the data source again&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Dashboard panels reference an old or deleted data source UID. This happens when a data source is deleted and recreated, since the new data source gets a different UID.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Edit each affected panel and reselect the correct InfluxDB data source from the data source drop-down.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Apply&lt;/strong&gt; to save each panel.&lt;/li&gt;
&lt;li&gt;To avoid this issue, update existing data sources instead of deleting and recreating them.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;404-not-found-when-sending-telegraf-metrics-to-grafana-cloud&#34;&gt;404 Not Found when sending Telegraf metrics to Grafana Cloud&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Error message:&lt;/strong&gt; &amp;ldquo;404 Not Found&amp;rdquo; when Telegraf writes to the Grafana Cloud InfluxDB-compatible endpoint.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The Telegraf &lt;code&gt;influxdb_v2&lt;/code&gt; output plugin isn&amp;rsquo;t compatible with the Grafana Cloud metrics endpoint. This commonly occurs when using PrivateLink or the standard InfluxDB-compatible write endpoint.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Switch the Telegraf output plugin from &lt;code&gt;influxdb_v2&lt;/code&gt; to &lt;code&gt;influxdb&lt;/code&gt; (v1) in your Telegraf configuration.&lt;/li&gt;
&lt;li&gt;Ensure the endpoint URL and credentials match those shown in your Grafana Cloud InfluxDB configuration page.&lt;/li&gt;
&lt;li&gt;Restart Telegraf after making the change.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;empty-query-results&#34;&gt;Empty query results&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The query returns no data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the time range includes data in your database.&lt;/li&gt;
&lt;li&gt;Check that the measurement and field names are correct. For SQL, table names in InfluxDB 3.x are case-sensitive.&lt;/li&gt;
&lt;li&gt;Test the query directly in the InfluxDB UI or CLI.&lt;/li&gt;
&lt;li&gt;Ensure filters are not excluding all data.&lt;/li&gt;
&lt;li&gt;For SQL, verify the &lt;code&gt;$__timeFilter(time)&lt;/code&gt; macro is included so the query uses the dashboard time range.&lt;/li&gt;
&lt;li&gt;For InfluxQL, verify the retention policy contains data for the selected time range.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;slow-query-performance&#34;&gt;Slow query performance&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Queries take a long time to execute.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce the time range of your query.&lt;/li&gt;
&lt;li&gt;Add more specific filters to limit the data scanned.&lt;/li&gt;
&lt;li&gt;Increase the &lt;strong&gt;Min time interval&lt;/strong&gt; setting to reduce the number of data points.&lt;/li&gt;
&lt;li&gt;Check InfluxDB server performance and resource utilization.&lt;/li&gt;
&lt;li&gt;For SQL, use &lt;code&gt;$__dateBin(time)&lt;/code&gt; with aggregation functions to downsample data. Add &lt;code&gt;WHERE&lt;/code&gt; clauses to narrow the query scope.&lt;/li&gt;
&lt;li&gt;For Flux, use &lt;code&gt;aggregateWindow()&lt;/code&gt; to downsample data before visualization.&lt;/li&gt;
&lt;li&gt;Consider using continuous queries or tasks to pre-aggregate data.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;data-appears-delayed-or-missing-recent-points&#34;&gt;Data appears delayed or missing recent points&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The visualization doesn&amp;rsquo;t show the most recent data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check the dashboard time range and refresh settings.&lt;/li&gt;
&lt;li&gt;Verify the &lt;strong&gt;Min time interval&lt;/strong&gt; is not set too high.&lt;/li&gt;
&lt;li&gt;Ensure InfluxDB has finished writing the data.&lt;/li&gt;
&lt;li&gt;Check for clock synchronization issues between Grafana and InfluxDB.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;enable-debug-logging&#34;&gt;Enable debug logging&lt;/h2&gt;
&lt;p&gt;To capture detailed error information for troubleshooting:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Set the Grafana log level to &lt;code&gt;debug&lt;/code&gt; in the configuration file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[log]
level = debug&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Review logs in &lt;code&gt;/var/log/grafana/grafana.log&lt;/code&gt; (or your configured log location).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Look for InfluxDB-specific entries that include request and response details.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reset the log level to &lt;code&gt;info&lt;/code&gt; after troubleshooting to avoid excessive log volume.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;get-additional-help&#34;&gt;Get additional help&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;ve tried the solutions in this guide and still encounter issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check the &lt;a href=&#34;https://docs.influxdata.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB documentation&lt;/a&gt; for API-specific guidance.&lt;/li&gt;
&lt;li&gt;Review the &lt;a href=&#34;https://community.grafana.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana community forums&lt;/a&gt; for similar issues.&lt;/li&gt;
&lt;li&gt;Review &lt;a href=&#34;https://github.com/grafana/grafana/issues?q=is%3Aissue&amp;#43;influxdb&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB data source issues on GitHub&lt;/a&gt; for known bugs.&lt;/li&gt;
&lt;li&gt;Contact Grafana Support if you&amp;rsquo;re an Enterprise, Cloud Pro, or Cloud Contracted user.&lt;/li&gt;
&lt;li&gt;When reporting issues, include:
&lt;ul&gt;
&lt;li&gt;Grafana version&lt;/li&gt;
&lt;li&gt;InfluxDB version and product (OSS, Cloud, Enterprise)&lt;/li&gt;
&lt;li&gt;Query language (Flux, InfluxQL, or SQL)&lt;/li&gt;
&lt;li&gt;Error messages (redact sensitive information)&lt;/li&gt;
&lt;li&gt;Steps to reproduce&lt;/li&gt;
&lt;li&gt;Relevant configuration such as data source settings, HTTP method, and TLS settings (redact tokens, passwords, and other credentials)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="troubleshoot-influxdb-data-source-issues">Troubleshoot InfluxDB data source issues&lt;/h1>
&lt;p>This document provides solutions to common issues you may encounter when configuring or using the InfluxDB data source. Issues are organized to follow the typical setup and usage workflow. For configuration instructions, refer to
&lt;a href="/docs/grafana/v13.0/datasources/influxdb/configure/">Configure the InfluxDB data source&lt;/a>.&lt;/p></description></item></channel></rss>