<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/v8.4/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/v8.4/datasources/influxdb/index.xml" rel="self" type="application/rss+xml"/><item><title>Flux support in Grafana</title><link>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/influxdb-flux/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/influxdb-flux/</guid><content><![CDATA[&lt;h1 id=&#34;flux-query-language-in-grafana&#34;&gt;Flux query language in Grafana&lt;/h1&gt;
&lt;p&gt;Grafana supports Flux running on InfluxDB 1.8&#43;. See &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;1.8 compatibility&lt;/a&gt; for more information and connection details.&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;Name&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;Name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The data source name. This is how you refer to the data source in panels and queries. We recommend something like &lt;code&gt;InfluxDB-Flux&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Default&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Default data source means that it will be pre-selected for new panels.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;URL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB 2.0 API port is by default 8086.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Organization&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;a href=&#34;https://v2.docs.influxdata.com/v2.0/organizations/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Influx organization&lt;/a&gt; that will be used for Flux queries. This is also used to for the &lt;code&gt;v.organization&lt;/code&gt; query macro.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The authentication token used for Flux queries. With Influx 2.0, use the &lt;a href=&#34;https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;influx authentication token to function&lt;/a&gt;. For influx 1.8, the token is &lt;code&gt;username:password&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Default bucket&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;(Optional) The &lt;a href=&#34;https://v2.docs.influxdata.com/v2.0/organizations/buckets/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Influx bucket&lt;/a&gt; that will be used for the &lt;code&gt;v.defaultBucket&lt;/code&gt; macro in Flux queries.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Min time interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;(Optional) Refer to &lt;a href=&#34;#min-time-interval&#34;&gt;Min time interval&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;Max series&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;(Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;min-time-interval&#34;&gt;Min time interval&lt;/h2&gt;
&lt;p&gt;A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example &lt;code&gt;1m&lt;/code&gt; if your data is written every minute.
This option can also be overridden/configured in a dashboard panel under data source options. It&amp;rsquo;s important to note that this value &lt;strong&gt;needs&lt;/strong&gt; to be formatted as a
number followed by a valid time identifier, e.g. &lt;code&gt;1m&lt;/code&gt; (1 minute) or &lt;code&gt;30s&lt;/code&gt; (30 seconds). The following time identifiers are supported:&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 use the &lt;a href=&#34;https://www.influxdata.com/products/flux/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Flux query and scripting language&lt;/a&gt;. Grafana&amp;rsquo;s Flux query editor is a text editor for raw Flux queries with Macro support.&lt;/p&gt;
&lt;h2 id=&#34;supported-macros&#34;&gt;Supported macros&lt;/h2&gt;
&lt;p&gt;The 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;Chronograf&lt;/a&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;Macro example&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;v.timeRangeStart&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Will be replaced by the start of the currently active time selection. For example, &lt;em&gt;2020-06-11T13:31:00Z&lt;/em&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;Will be replaced by the end of the currently active time selection. For example, &lt;em&gt;2020-06-11T14:31:00Z&lt;/em&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;Will be replaced with an interval string compatible with Flux that corresponds to Grafana&amp;rsquo;s calculated interval based on the time range of the active time selection. For example, &lt;em&gt;5s&lt;/em&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;Will be replaced with the data source configuration&amp;rsquo;s &amp;ldquo;Default Bucket&amp;rdquo; setting&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;Will be replaced with the data source configuration&amp;rsquo;s &amp;ldquo;Organization&amp;rdquo; setting&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;For example, the following query will be interpolated as the query that follows it, with interval and time period values changing according to active time selection):&lt;/p&gt;
&lt;p&gt;Grafana 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;Interpolated query send to Influx:&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;You can view the interpolated version of a query with the query inspector. For more information, refer to &lt;a href=&#34;../../../panels/working-with-panels/navigate-inspector-panel/&#34;&gt;Navigate the Query Inspector&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="flux-query-language-in-grafana">Flux query language in Grafana&lt;/h1>
&lt;p>Grafana supports Flux running on InfluxDB 1.8+. See &lt;a href="https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility" target="_blank" rel="noopener noreferrer">1.8 compatibility&lt;/a> for more information and connection details.&lt;/p>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Name&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>Name&lt;/code>&lt;/td>
&lt;td>The data source name. This is how you refer to the data source in panels and queries. We recommend something like &lt;code>InfluxDB-Flux&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Default&lt;/code>&lt;/td>
&lt;td>Default data source means that it will be pre-selected for new panels.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>URL&lt;/code>&lt;/td>
&lt;td>The HTTP protocol, IP address and port of your InfluxDB API. InfluxDB 2.0 API port is by default 8086.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Organization&lt;/code>&lt;/td>
&lt;td>The &lt;a href="https://v2.docs.influxdata.com/v2.0/organizations/" target="_blank" rel="noopener noreferrer">Influx organization&lt;/a> that will be used for Flux queries. This is also used to for the &lt;code>v.organization&lt;/code> query macro.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Token&lt;/code>&lt;/td>
&lt;td>The authentication token used for Flux queries. With Influx 2.0, use the &lt;a href="https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/" target="_blank" rel="noopener noreferrer">influx authentication token to function&lt;/a>. For influx 1.8, the token is &lt;code>username:password&lt;/code>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Default bucket&lt;/code>&lt;/td>
&lt;td>(Optional) The &lt;a href="https://v2.docs.influxdata.com/v2.0/organizations/buckets/" target="_blank" rel="noopener noreferrer">Influx bucket&lt;/a> that will be used for the &lt;code>v.defaultBucket&lt;/code> macro in Flux queries.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Min time interval&lt;/code>&lt;/td>
&lt;td>(Optional) Refer to &lt;a href="#min-time-interval">Min time interval&lt;/a>.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>Max series&lt;/code>&lt;/td>
&lt;td>(Optional) Limits the number of series/tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have lots of small time series and not all are shown. Defaults to 1000.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="min-time-interval">Min time interval&lt;/h2>
&lt;p>A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example &lt;code>1m&lt;/code> if your data is written every minute.
This option can also be overridden/configured in a dashboard panel under data source options. It&amp;rsquo;s important to note that this value &lt;strong>needs&lt;/strong> to be formatted as a
number followed by a valid time identifier, e.g. &lt;code>1m&lt;/code> (1 minute) or &lt;code>30s&lt;/code> (30 seconds). The following time identifiers are supported:&lt;/p></description></item><item><title>InfluxDB templates</title><link>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/influxdb-templates/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/influxdb-templates/</guid><content><![CDATA[&lt;h2 id=&#34;influxdb-templates&#34;&gt;InfluxDB templates&lt;/h2&gt;
&lt;p&gt;Instead of hard-coding things like server, application and sensor name in your metric queries you can use variables in their place.&lt;/p&gt;
&lt;p&gt;For more information, refer to &lt;a href=&#34;../../../variables/&#34;&gt;Templates and variables&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;using-variables-in-influxdb-queries&#34;&gt;Using variables in InfluxDB queries&lt;/h2&gt;
&lt;p&gt;There are two syntaxes:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$&amp;lt;varname&amp;gt;&lt;/code&gt; 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 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;&lt;code&gt;[[varname]]&lt;/code&gt; 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 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;Why two ways? The first syntax is easier to read and write but does not allow you to use a variable in the middle of a word. When the &lt;strong&gt;Multi-value&lt;/strong&gt; or &lt;strong&gt;Include all value&lt;/strong&gt; options are enabled, Grafana converts the labels from plain text to a regex compatible string. Which means you have to use &lt;code&gt;=~&lt;/code&gt; instead of &lt;code&gt;=&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Example dashboard:
&lt;a href=&#34;https://play.grafana.org/dashboard/db/influxdb-templated&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB Templated Dashboard&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;query-variables&#34;&gt;Query variables&lt;/h2&gt;
&lt;p&gt;If you add a query template variable, then you can write an InfluxDB exploration (metadata) query. These queries can return things like measurement names, key names or key values. For more information, refer to &lt;a href=&#34;../../../variables/variable-types/add-query-variable/&#34;&gt;Add query variable&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, you can have a variable that contains all values for tag &lt;code&gt;hostname&lt;/code&gt; if you specify a query like this in the query variable &lt;strong&gt;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;SHOW TAG VALUES WITH KEY = &amp;#34;hostname&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;chained-or-nested-variables&#34;&gt;Chained or nested variables&lt;/h2&gt;
&lt;p&gt;You can also create nested variables, sometimes called &lt;a href=&#34;../../../variables/variable-types/chained-variables/&#34;&gt;chained variables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, if you had another variable, for example &lt;code&gt;region&lt;/code&gt;. Then you could have the hosts variable only show hosts from the current selected region with a query like this:&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;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;If you have a variable with key names you can use this variable in a group by clause. This will allow you to change group by using the variable list at the top of the dashboard.&lt;/p&gt;
&lt;h3 id=&#34;ad-hoc-filters-variable&#34;&gt;Ad hoc filters variable&lt;/h3&gt;
&lt;p&gt;InfluxDB supports the special &lt;code&gt;Ad hoc filters&lt;/code&gt; variable type. This variable allows you to specify any number of key/value filters on the fly. These filters are automatically applied to all your InfluxDB queries.&lt;/p&gt;
&lt;p&gt;For more information, refer to &lt;a href=&#34;../../../variables/variable-types/add-ad-hoc-filters/&#34;&gt;Add ad hoc filters&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h2 id="influxdb-templates">InfluxDB templates&lt;/h2>
&lt;p>Instead of hard-coding things like server, application and sensor name in your metric queries you can use variables in their place.&lt;/p>
&lt;p>For more information, refer to &lt;a href="../../../variables/">Templates and variables&lt;/a>.&lt;/p></description></item><item><title>Provision InfluxDB</title><link>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/provision-influxdb/</link><pubDate>Sat, 04 Apr 2026 12:26:57 +0000</pubDate><guid>https://grafana.com/docs/grafana/v8.4/datasources/influxdb/provision-influxdb/</guid><content><![CDATA[&lt;h1 id=&#34;provision-influxdb&#34;&gt;Provision InfluxDB&lt;/h1&gt;
&lt;p&gt;You can configure data sources using config files with Grafana&amp;rsquo;s provisioning system. You can read more about how it works and all the settings you can set for data sources on the &lt;a href=&#34;../../../administration/provisioning/#datasources&#34;&gt;provisioning docs page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here are some provisioning examples for this data source.&lt;/p&gt;
&lt;h2 id=&#34;influxdb-1x-example&#34;&gt;InfluxDB 1.x example&lt;/h2&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
    database: site
    user: grafana
    url: http://localhost:8086
    jsonData:
      httpMode: GET
    secureJsonData:
      password: grafana&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;influxdb-2x-for-flux-example&#34;&gt;InfluxDB 2.x for Flux example&lt;/h2&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
    secureJsonData:
      token: token
    jsonData:
      version: Flux
      organization: organization
      defaultBucket: bucket
      tlsSkipVerify: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;influxdb-2x-for-influxql-example&#34;&gt;InfluxDB 2.x for InfluxQl example&lt;/h2&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
    # This database should be mapped to a bucket
    database: site
    jsonData:
      httpMode: GET
      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;
]]></content><description>&lt;h1 id="provision-influxdb">Provision InfluxDB&lt;/h1>
&lt;p>You can configure data sources using config files with Grafana&amp;rsquo;s provisioning system. You can read more about how it works and all the settings you can set for data sources on the &lt;a href="../../../administration/provisioning/#datasources">provisioning docs page&lt;/a>.&lt;/p></description></item></channel></rss>