<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>InfluxData Blog - Michael Hall</title>
    <description>Posts by Michael Hall on the InfluxData Blog</description>
    <link>https://www.influxdata.com/blog/author/michael-hall/</link>
    <language>en-us</language>
    <lastBuildDate>Fri, 04 Nov 2022 07:00:00 +0000</lastBuildDate>
    <pubDate>Fri, 04 Nov 2022 07:00:00 +0000</pubDate>
    <ttl>1800</ttl>
    <item>
      <title>Congratulations to the Third Annual InfluxDays Community Awards Winners</title>
      <description>&lt;p&gt;Every year since I started at InfluxData, it has been my honor to recognize those community members who have made outstanding contributions to both the InfluxDB community and to our products over the past year. It’s always amazing to see people sharing their knowledge, their skills, and their passion with each other. Our community is an integral part of our success; we couldn’t build &lt;a href="https://www.influxdata.com/time-series-platform/telegraf/"&gt;Telegraf&lt;/a&gt;, &lt;a href="https://www.influxdata.com/products/influxdb-overview/"&gt;InfluxDB&lt;/a&gt; or &lt;a href="https://www.influxdata.com/products/flux/"&gt;Flux&lt;/a&gt; without their feedback and perspectives.&lt;/p&gt;

&lt;p&gt;InfluxDB is the &lt;a href="https://www.influxdata.com/time-series-database/"&gt;purpose-built&lt;/a&gt; time series data platform with over 705,000 daily active instances of InfluxDB OSS running. There are 75,000 + developers using &lt;a href="https://www.influxdata.com/products/influxdb-cloud/"&gt;InfluxDB Cloud&lt;/a&gt; globally — the number of people using the serverless platform has nearly doubled since last year. We’re excited to see the community growing every year.&lt;/p&gt;

&lt;p&gt;We just wrapped up InfluxDays 2022 — our annual user conference. InfluxDays 2022 included watch parties, conference sessions, and &lt;a href="https://university.influxdata.com/"&gt;InfluxDB University&lt;/a&gt; trainings. Additionally, developers were able to sharpen their skills with the InfluxDB University Challenge throughout the conference. It was a blast getting to hang out with our community members in person again, and share all of the exciting developments we’ve been making to the platform. Learn more about &lt;a href="https://www.influxdata.com/products/influxdb-engine/"&gt;InfluxDB IOx&lt;/a&gt;, InfluxDB’s new storage engine, &lt;a href="https://www.influxdata.com/blog/influxdb-engine/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The InfluxData Community Award winners are nominated by the people they interact with, both InfluxData staff and other users in the community. Because there are so many places and ways to contribute to the InfluxDB Community, we choose one winner for each of the following categories:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;InfluxDB -&lt;/strong&gt; For general contribution to InfluxDB itself, including the UI, deployment configurations, documentation or tutorials&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Telegraf -&lt;/strong&gt; For contributing bug fixes, new features, plugins, documentation, or tutorials&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flux Language -&lt;/strong&gt; For contributing to the design and implementation of Flux, improvements to the language, extensions, documentation, tutorials, or support&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Community -&lt;/strong&gt; For providing community support, events, engagement, promotions or any other activity that has helped us grow our global community&lt;/p&gt;

&lt;p&gt;The 2022 InfluxData Community Award winners are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The InfluxDB Award:&lt;/strong&gt;  &lt;a href="https://github.com/Franky1"&gt;Arvid Teichtmann&lt;/a&gt; (also known as Franky1) – For his consistent support in the community forums, especially for answering questions about InfluxDB and sharing his knowledge of its tools.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Telegraf Award:&lt;/strong&gt;  &lt;a href="https://github.com/Hipska"&gt;Thomas Casteleyn&lt;/a&gt; – For his continued outstanding support of the Telegraf community. Nobody has provided more support, answered more questions, or helped more people than Thomas has.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Flux Language Award:&lt;/strong&gt;  &lt;a href="https://github.com/2opremio"&gt;Alfonso Acosta&lt;/a&gt; – For making many significant fixes and contributions to the Flux language itself and engaging with the Flux engineering team to help improve the language for everyone.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;The Community Award:&lt;/strong&gt;  &lt;a href="https://github.com/Trovalo"&gt;Giovanni Luisotto&lt;/a&gt; – For contributions across our community forums, Slack, Github and Stack Overflow, and across a broad range of topics, which highlights both the depth and breadth of his knowledge.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Congratulations to this year’s winners!&lt;/strong&gt; It’s not easy picking just four winners out of the tens of thousands that have been active in our community, but these four stand out for their sustained involvement and commitment to helping other users of InfluxDB, Telegraf, and Flux. I would like to personally thank them for their contributions to the community and congratulate them on receiving the recognition and appreciation of their peers. We invite you to join the &lt;a href="http://influxdata.com/built-on-influxdb/"&gt;Built on InfluxDB program&lt;/a&gt; to share your InfluxDB projects and solutions &lt;a href="https://www.influxdata.com/get-hoodie/"&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
      <pubDate>Fri, 04 Nov 2022 07:00:00 +0000</pubDate>
      <link>https://www.influxdata.com/blog/third-annual-influxdays-community-awards/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/third-annual-influxdays-community-awards/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>Using InfluxDB as an IoT Edge Historian</title>
      <description>&lt;p&gt;InfluxDB is increasingly being used in IoT solutions to store data from connected devices. Now it can also be used on IoT &lt;a href="https://www.influxdata.com/glossary/edge-computing/"&gt;edge&lt;/a&gt; gateways as a data historian to analyze, visualize and eventually transmit aggregated IoT data up to a centralized server. In this article we’re going to look at three simple ways you can connect an instance of InfluxDB on your &lt;a href="https://www.influxdata.com/glossary/iot-devices/"&gt;IoT Edge device&lt;/a&gt; to another instance of InfluxDB in the cloud.&lt;/p&gt;
&lt;h2&gt;Preparing your edge instance of InfluxDB&lt;/h2&gt;

&lt;p&gt;To begin with, we need a local instance of InfluxDB to use as our edge historian. The simplest way to do this is in your local development to run the official Docker image:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;docker run -p 8086:8086 influxdb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then you will need to complete the setup by going to &lt;a href="http://localhost:8086"&gt;http://localhost:8086&lt;/a&gt; and following the on-screen instructions. Remember what you use for your Organization during this setup – you’ll need that information later!&lt;/p&gt;

&lt;p&gt;Next, navigate to the &lt;strong&gt;Load Data&lt;/strong&gt; -&amp;gt; &lt;strong&gt;API Tokens&lt;/strong&gt; screen, and grab the token string that was generated for you during setup – you’ll need that later too.&lt;/p&gt;

&lt;p&gt;Tip: The default token lets you control everything in InfluxDB — it’s very powerful. When deploying your solution into production, you’re going to want to create a new, less powerful token that only has permissions to read or write from specific buckets.&lt;/p&gt;

&lt;p&gt;Then use these values to setup your Influx CLI, which we will be using extensively in the rest of this article:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-markup"&gt;influx config create &amp;ndash;active &amp;ndash;name "edge" &amp;ndash;host "http://localhost:8086" &amp;ndash;org "your_edge_org" &amp;ndash;token "your_edge_token"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now it’s time to setup a bucket on this instance to store our device data in:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;influx bucket create --name "devices" --retention 1h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We’re using a 1 hour retention policy on this bucket. In a real world scenario where you’re gathering a lot of high-frequency sensor data on a relatively low-powered IoT edge device, you’re not going to have a lot of space to store it indefinitely. InfluxDB’s retention policies make it easy to put a limit on that. Don’t worry about losing data though — this article will show you how to keep that data around long-term by transmitting it up to your cloud instance.&lt;/p&gt;
&lt;h2&gt;Faking an IoT device&lt;/h2&gt;
&lt;p&gt;While the rest of this article will work for any IoT data you are collecting, we’re going to keep the examples simple by using a mock device to generate some artificial sensor data. To do that we’re going to use the &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mock"&gt;new inputs.mock plugin&lt;/a&gt; from the Telegraf project. We will generate two fields: temperature and humidity, like you might get from an inexpensive DHT sensor.&lt;/p&gt;

&lt;p&gt;First we’ll generate a new Telegraf configuration using just the plugins we need for this article:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;telegraf --aggregator-filter none  --processor-filter none --input-filter mock --output-filter influxdb_v2 config  &amp;gt; telegraf.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will create a new file for you named &lt;code class="language-markup"&gt;telegraf.conf&lt;/code&gt; with sections for &lt;code class="language-markup"&gt;inputs.mock&lt;/code&gt; and &lt;code class="language-markup"&gt;outputs.influxdb_v2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You will need to fill these sections in with the following data:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-ini"&gt;[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "your_edge_token"
  organization = "your_edge_org"
  bucket = "devices"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-ini"&gt;[[inputs.mock]]
  ## Set the metric name to use for reporting
  metric_name = "dht"

[[inputs.mock.stock]]
  name = "temperature"
  price = 20.0
  volatility = 0.05

[[inputs.mock.stock]]
  name = "humidity"
  price = 50.0
  volatility = 0.05

[inputs.mock.tags]
  "device_id" = "001"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first section tells Telegraf how to connect to your edge instance to write data to it. Use the organization name and token string you captured during the setup of your edge instance.&lt;/p&gt;

&lt;p&gt;The second section defines our mock device with &lt;code class="language-markup"&gt;temperature&lt;/code&gt; and &lt;code class="language-markup"&gt;humidity&lt;/code&gt; fields, and &lt;code class="language-markup"&gt;device_id&lt;/code&gt; tag. Here I’m using the &lt;code class="language-markup"&gt;inputs.mock.stock&lt;/code&gt; type to generate a field with a value that changes randomly but gradually over time, as temperature and humidity would. There are other generator types that you can use to more accurately simulate other forms of data.&lt;/p&gt;

&lt;p&gt;Tip: You can use multiple &lt;code class="language-ini"&gt;inputs.mock&lt;/code&gt; sections to simulate multiple devices at the same time, giving them each a different &lt;code class="language-ini"&gt;device_id&lt;/code&gt; tag value.&lt;/p&gt;

&lt;p&gt;We’re also going to change the default Telegraf collection interval to one second, because IoT devices don’t typically wait 10 seconds between records, so scroll up to the agent section and change the &lt;code class="language-markup"&gt;interval&lt;/code&gt; to &lt;code class="language-markup"&gt;1s&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-ini"&gt;[agent]
  ## Default data collection interval for all inputs
  interval = "1s"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you can start Telegraf using this configuration and let it start sending data to your edge instance while we get your cloud instance ready:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-ini"&gt;telegraf &amp;ndash;config ./telegraf.conf&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;Preparing your cloud instance of InfluxDB&lt;/h2&gt;
&lt;p&gt;Your cloud instance is going to be where you aggregate data from multiple edge devices at once. It doesn’t have to be “in the cloud” specifically, it can be running in your private data center or anywhere else, the key thing is that it’s somewhere all of your edge devices can talk to it. If you don’t already have such an instance available, you can &lt;a href="https://cloud2.influxdata.com/signup"&gt;sign up for a free account&lt;/a&gt; on the InfluxDB Cloud platform. Everything in this article will run within the free tier, so it won’t cost you anything to follow along.&lt;/p&gt;

&lt;p&gt;Just like with our edge instance, you will need to gather the host, organization name, and access token from your cloud instance. Then we’ll use them to create a second configuration in the CLI, so you can switch back and forth between your edge instance and your cloud instance:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;influx config create &amp;ndash;active &amp;ndash;name "cloud" &amp;ndash;host "your_cloud_host" &amp;ndash;org "your_cloud_org" &amp;ndash;token "your_cloud_token"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Tip: You can see both of your configurations by running influx config list, and switch between them using &lt;code class="language-markup"&gt;influx config edge&lt;/code&gt; or &lt;code class="language-markup"&gt;influx config cloud&lt;/code&gt; respectively.
Then we’re going to create a bucket to store data coming in from our edge devices:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;influx bucket create --name "edge_devices" --retention 30d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Unlike our &lt;code class="language-bash"&gt;devices&lt;/code&gt; bucket on our edge instance, here we will use a 30 day retention policy, because our cloud instance has room for that (and it fits within the free tier use limits for InfluxDB Cloud).&lt;/p&gt;

&lt;h2&gt;Store cloud authentication in your edge host&lt;/h2&gt;

&lt;p&gt;This step is optional, but highly recommended. You’ll need to use your cloud credentials in Flux tasks to connect to your cloud instance from your edge instance, but keeping those credentials in plain text in your scripts is poor security.&lt;/p&gt;

&lt;p&gt;So instead we’re going to make use of InfluxDB’s built-in secret store to put those in a write-only space that we can reference from our scripts, using the following commands:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-bash"&gt;influx config edge
influx secret update --key cloud_host  --value "your_cloud_host"
influx secret update --key cloud_org   --value "your_cloud_org"
influx secret update --key cloud_token --value "your_cloud_token"&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Basic Store and Forward&lt;/h2&gt;

&lt;p&gt;The simplest setup is to take all of the data from your edge instance, and forward it as-is up to your cloud instance. To do that, create a new Task on your edge instance, set to run every minute.&lt;/p&gt;

&lt;p&gt;You can do this from the UI at &lt;a href="http://localhost:8086"&gt;http://localhost:8086&lt;/a&gt; or using the &lt;a href="https://marketplace.visualstudio.com/items?itemName=influxdata.flux"&gt;VisualStudio Code plugin&lt;/a&gt; for Flux, which is the way I did it:&lt;/p&gt;

&lt;p&gt;&lt;img class="size-full wp-image-266049 aligncenter" src="/images/legacy-uploads/Timeline-Add-Task.png" alt="Timeline - Add-Task" width="838" height="420" /&gt;&lt;/p&gt;

&lt;p&gt;The we’ll use the following Flux script for the task:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;import "influxdata/influxdb/tasks"
import "influxdata/influxdb/secrets"

option task = {name: "northbound", every: 1m, offset: 0s}

cloud_host = secrets.get(key: "cloud_host")
cloud_org = secrets.get(key: "cloud_org")
cloud_token = secrets.get(key: "cloud_token")

from(bucket: "devices")
|&amp;gt; range(start: tasks.lastSuccess(orTime: -1h))
|&amp;gt; set(key: "edge_id", value: "001")
|&amp;gt; to(host: cloud_host, org: cloud_org, token: cloud_token, bucket: "edge_devices")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s walk through this step by step:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;import "influxdata/influxdb/tasks"
import "influxdata/influxdb/secrets"&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The import lines bring some key functionality into our Task’s script. The first line gives us a tasks package that we will use to find the last time this task ran successfully. The second line gives us a secrets object which will give us access to the cloud credentials we saved to the InfluxDB secret store previously.&lt;/p&gt;

&lt;p&gt;&lt;code class="language-javascript"&gt;option task = {name: "northbound", every: 1m, offset: 0s}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This line was automatically included for us when we created this new task, using the values we entered in the VSCode form. This is how InfluxDB Tasks store these values.&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;cloud_host = secrets.get(key: "cloud_host")
cloud_org = secrets.get(key: "cloud_org")
cloud_token = secrets.get(key: "cloud_token")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The next three lines retrieve our saved secrets, and place them in Flux variables. We will pass these variables to our Flux to() function so that it can connect to our cloud instance.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;from(bucket: "devices")
|&amp;gt; range(start: tasks.lastSuccess(orTime: -1h))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first part of our query specifies what data to fetch from our local edge instance. We’re reading data from the devices bucket that we configured Telegraf to write to. Here we’re using the tasks package we imported earlier to find the last time that this task ran, this will let us only fetch new data that hasn’t already been sent to the cloud, saving us some bandwidth. It also makes this task more robust because if it fails for whatever reason (such as a connectivity issue between your edge and cloud) the next run will include all the data from the previous one.&lt;/p&gt;

&lt;p&gt;The &lt;code class="language-markup"&gt;orTime&lt;/code&gt; parameter provides a default time, which will be used the first time the task is run.&lt;/p&gt;

&lt;p&gt;&lt;code class="language-javascript"&gt;|&amp;gt; set(key: "edge_id", value: "001")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This next line adds a bit of extra information to our data. In a typical edge IoT scenario you’re going to have more than one edge location, and each location is going to have multiple devices. We’re already collecting a device_id from Telegraf, but there’s nothing in that data that says what edge location it was being collected from. Once we have data from multiple locations being mixed together in the cloud it would be difficult to distinguish between them. So here we’re going to inject an edge_id into the datastream before sending it, to identify our edge location.&lt;/p&gt;

&lt;p&gt;&lt;code class="language-javascript"&gt;|&amp;gt; to(host: cloud_host, org: cloud_org, token: cloud_token, bucket: "edge_devices")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally we’re ready to send the data up to the cloud! This last step only takes a single function call, the built in to() function, which can write your query data to a local bucket or, in this case, ro a remote bucket by passing in the authentication credentials for our remote InfluxDB instance.&lt;/p&gt;

&lt;p&gt;That’s it! Save your task and from now on all of your local data will be copied up into your cloud instance, every minute, automatically!&lt;/p&gt;

&lt;h2&gt;Downsampling before Forwarding&lt;/h2&gt;

&lt;p&gt;While the task we just wrote is simple and works well, it’s still going to be sending a lot of data up to your cloud. In a real world scenario you’re going to have dozens, if not hundreds, of devices on each edge, and some of them will be producing data multiple times per second, or even microsecond! Even with our mock device we’re producing a new value every second. That’s a lot of very detailed data that you most likely don’t need for the high level use cases you’ll be running in the cloud, it’s just going to take up extra bandwidth to transfer and extra space to store.&lt;/p&gt;

&lt;p&gt;Instead, what if we could reduce the volume of data before we send it, even if that means losing some of the granularity? This process is known as downsampling or materialized views, and is extremely common when moving data up to higher and higher levels. It’s also extremely easy to do with Flux, right inside our task! Here’s what it looks like:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;import "influxdata/influxdb/tasks"
import "influxdata/influxdb/secrets"

option task = {name: "northbound", every: 1m, offset: 0s}

cloud_host = secrets.get(key: "cloud_host")
cloud_org = secrets.get(key: "cloud_org")
cloud_token = secrets.get(key: "cloud_token")

from(bucket: "devices")
|&amp;gt; range(start: tasks.lastSuccess(orTime: -1h))
|&amp;gt; aggregateWindow(every: 5m, fn: mean, createEmpty: false)
|&amp;gt; set(key: "edge_id", value: "001")
|&amp;gt; to(host: cloud_host, org: cloud_org, token: cloud_token, bucket: "edge_devices")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, we only needed to add a single line to our Flux code:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-javascript"&gt;|&amp;gt; aggregateWindow(every: 5m, fn: mean, createEmpty: false)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This line takes the data we’re reading from our bucket, and calculates the average (mean) value of each field over a rolling 5 minute window, reducing 300 individual measurements into just one. Then that dowsampled data is sent to our cloud instance just like before.&lt;/p&gt;

&lt;p&gt;Flux provides a number of built-in &lt;a href="https://docs.influxdata.com/flux/v0.x/function-types/#aggregates"&gt;aggregation functions&lt;/a&gt; beyond &lt;code class="language-javascript"&gt;mean&lt;/code&gt;, you can instead calculate the min, max, integral, standard deviation, and much more! You can also define your own aggregation function if you want something more complex, like a swinging door compression algorithm, it’s entirely up to you.&lt;/p&gt;

&lt;h2&gt;Adapting for high resiliency at the Edge&lt;/h2&gt;

&lt;p&gt;By now we have a task that is both efficient in what data it is sending to the cloud, and resilient to short connectivity problems. But what if those connectivity problems persist for more than an hour? That may not be a concern for a smart building or factory, but if your edge is a wind turbine or oil rig it’s a real possibility. Because our devices bucket that gathers raw data only has a 1 hour retention policy, any outage longer than that will result in lost data. We can extend that retention, but then storage space becomes a concern as you’re having to save more and more of that high volume data.&lt;/p&gt;

&lt;p&gt;The solution to this problem is to store our smaller downsampled data on the edge for a longer period of time. To do that, we first need a new bucket:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-bash"&gt;influx config edge
influx bucket create --name northbound --retention 1d&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For our new bucket, which we called &lt;code class="language-bash"&gt;northbound&lt;/code&gt;, we’re using a 1 day retention policy, instead of just one hour. That will allow our edge instance to be disconnected for a full 24 hours before we start to lose data.&lt;/p&gt;

&lt;p&gt;The next step is to split our task into two. First, create a new task named &lt;code class="language-javascript"&gt;aggregate_local&lt;/code&gt;, and set it to run every minute. This task will perform the downsampling of data from the &lt;code class="language-bash"&gt;devices&lt;/code&gt; bucket, and store that in the &lt;code class="language-bash"&gt;northbound&lt;/code&gt; bucket.&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;import "influxdata/influxdb/tasks"

option task = {name: "aggregate_local", every: 1m, offset: 0s}

from(bucket: "devices")
|&amp;gt; range(start: tasks.lastSuccess(orTime: -1h))
|&amp;gt; aggregateWindow(every: 5m, fn: mean, createEmpty: false)
|&amp;gt; set(key: "edge_id", value: "001")
|&amp;gt; to(bucket: "northbound")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This task no longer needs to import &lt;code class="language-markup"&gt;influxdata/influxdb/secrets&lt;/code&gt;, or fetch credentials from the secret store, because it’s writing our downsampled data to a local bucket. In this task we’re performing both the downsampling with &lt;code class="language-markup"&gt;aggregateWindow&lt;/code&gt;, and injecting our &lt;code class="language-markup"&gt;edge_id&lt;/code&gt; with the set function, so that the data being written to northbound is exactly what we want being sent to the cloud.&lt;/p&gt;

&lt;p&gt;The second task will then read data from the &lt;code class="language-markup"&gt;northbound&lt;/code&gt; bucket and send it, without modification, to our cloud instance. Create this task with the name &lt;code class="language-markup"&gt;sync_northbound&lt;/code&gt; and set it to run every 5 minutes.&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;import "influxdata/influxdb/tasks"
import "influxdata/influxdb/secrets"

option task = {name: "sync_northbound", every: 5m, offset: 0s}

cloud_host = secrets.get(key: "cloud_host")
cloud_org = secrets.get(key: "cloud_org")
cloud_token = secrets.get(key: "cloud_token")

from(bucket: "northbound")
|&amp;gt; range(start: tasks.lastSuccess(orTime: -1h))
|&amp;gt; to(host: cloud_host, org: cloud_org, token: cloud_token, bucket: "edge_devices")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here we once again use the secret store to retrieve our credentials, but our query doesn’t need the &lt;code class="language-markup"&gt;aggregateWindow&lt;/code&gt; or &lt;code class="language-markup"&gt;set&lt;/code&gt; calls, because we’ve already performed those steps before writing data to the &lt;code class="language-markup"&gt;northbound&lt;/code&gt; bucket.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Now we have InfluxDB running at the edge, collecting data from connected devices (mock ones in this case), storing that data temporarily and the edge while also transmitting it up to another InfluxDB instance running in the cloud. We went through multiple iterations of task scripts to make this process more efficient with downsampling, and more robust to connectivity issues by extending local retention. All of this was accomplished using only InfluxDB and just a handful of lines of Flux script.&lt;/p&gt;

&lt;p&gt;But this is only a small taste of what you can do! Once you start tailoring this setup to your own specific needs you can enhance your Flux scripts with smarter downsampling algorithms, enhance your device data with &lt;a href="https://docs.influxdata.com/flux/v0.x/stdlib/sql/from/"&gt;meta-data from SQL servers&lt;/a&gt;, &lt;a href="https://awesome.influxdata.com/docs/part-3/checks-and-notifications/"&gt;trigger alerts&lt;/a&gt; based on thresholds or loss of data from devices, and so much more.&lt;/p&gt;
</description>
      <pubDate>Thu, 17 Mar 2022 04:00:20 -0700</pubDate>
      <link>https://www.influxdata.com/blog/influxdb-iot-edge-historian/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/influxdb-iot-edge-historian/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>How to Pivot Your Data in Flux: Working with Columnar Data</title>
      <description>&lt;div style="padding:56.25% 0 0 0;position:relative;"&gt;&lt;iframe src="https://player.vimeo.com/video/676043595?h=9d10d5a761&amp;amp;badge=0&amp;amp;autopause=0&amp;amp;player_id=0&amp;amp;app_id=58479" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen="" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="Pivots in Flux"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;script src="https://player.vimeo.com/api/player.js"&gt;&lt;/script&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Relational databases are by far the most common type of database, and as software developers it’s safe to say that they are the kind of database most of us got started on, and probably still use on a regular basis. And one thing that they all have in common is the way they structure data. InfluxDB, however, structures data a little bit differently.&lt;/p&gt;
&lt;h2&gt;RDBMS default table structure&lt;/h2&gt;
&lt;p&gt;With a relational database you have a collection of tables, each with its own fixed layout of columns, and you read and write data in rows. Each row has a column that holds a value for each field, and you get all of those values at the same time, giving you a table that looks like this:&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;time&lt;/td&gt;
&lt;td class="tb-grey"&gt;field1&lt;/td&gt;
&lt;td class="tb-grey"&gt;field2&lt;/td&gt;
&lt;td class="tb-grey"&gt;host&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;123&lt;/td&gt;
&lt;td&gt;789&lt;/td&gt;
&lt;td&gt;myhost1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;456&lt;/td&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;InfluxDB result data&lt;/h3&gt;
&lt;p&gt;InfluxDB doesn’t follow this pattern. It returns data in what’s known as a columnar format, which just means that you will get the data one column at a time, rather than one row at a time. This is often a source of confusion for developers who are used to the row format they worked with from a relational database, but it has many benefits when working with time series data.&lt;/p&gt;

&lt;p&gt;When you run a basic Flux query like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;from(bucket: "telegraf")
  |&amp;gt; range(start: -1d)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will get data returned like this:&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;table&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_measurement*&lt;/td&gt;
&lt;td class="tb-yellow fnt500"&gt;_field*&lt;/td&gt;
&lt;td class="tb-yellow"&gt;_value&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_start*&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_stop*&lt;/td&gt;
&lt;td class="tb-grey"&gt;_time&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;host*&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field1&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;123&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field1&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;456&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field2&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;789&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field2&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;101&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The first thing you’ll notice is that the table’s column headers are NOT your field names like they would be if you were querying a &lt;a href="https://www.influxdata.com/glossary/sql/"&gt;SQL&lt;/a&gt; database. Instead your query will return your results with these same columns, and each record (represented by &lt;code class="language-javascript"&gt;r&lt;/code&gt; in the query below) in the result will represent a single field’s value at that point in time.&lt;/p&gt;

&lt;p&gt;This is why when you filter your Flux query, it looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;|&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "mydata")
|&amp;gt; filter(fn: (r) =&amp;gt; r["_field"] == "field1")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This data structure allows for faster queries and aggregations in the most common usage patterns for InfluxDB. Because InfluxDB is processing one column’s values at a time, it can perform calculations on the data for just that field instead of performing multiple calculations at the same time.&lt;/p&gt;
&lt;h3&gt;Pivoting between column-like and row-like data layouts&lt;/h3&gt;
&lt;p&gt;There are times, however, when you are going to want your data to look more like the results of a traditional database query. To do that you need to perform a “pivot” operation. Pivoting data is the act of flipping it from having the fields in separate rows to having the fields in separate columns.&lt;/p&gt;

&lt;p&gt;Flux provides a &lt;a href="https://docs.influxdata.com/flux/v0.x/stdlib/universe/pivot/"&gt;&lt;code class="language-javascript"&gt;pivot&lt;/code&gt;&lt;/a&gt; function that does precisely this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;|&amp;gt; pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This function will flip your data so that every row represents a moment in time (&lt;code class="language-javascript"&gt;rowKey:["_time"]&lt;/code&gt;), your fields will each become a column (&lt;code class="language-markup"&gt;columnKey: ["_field"]&lt;/code&gt;), and the value in each column will be your field’s value (&lt;code class="language-javascript"&gt;valueColumn: "_value"&lt;/code&gt;). Giving you a result that looks like this:&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;table&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_measurement*&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_start*&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_stop*&lt;/td&gt;
&lt;td class="tb-grey"&gt;_time&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;host*&lt;/td&gt;
&lt;td class="tb-yellow"&gt;field1&lt;/td&gt;
&lt;td class="tb-yellow"&gt;field2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost1&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;123&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;789&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td&gt;myhost2&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;456&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Using fieldsAsCols instead&lt;/h3&gt;
&lt;p&gt;This is the most common way people want to pivot their data, because it puts it into the same shape as they’re used to working with from a traditional database. It’s so common, in fact, that we provide a shortcut function in the &lt;a href="https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/fieldsascols/"&gt;&lt;code class="language-javascript"&gt;schema&lt;/code&gt;&lt;/a&gt; package just for that use case.&lt;/p&gt;

&lt;p&gt;After importing &lt;code class="language-javascript"&gt;schema&lt;/code&gt; into your Flux script, the above line of code can be replaced with:.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;Flux
  |&amp;gt; fieldsAsCols()&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Other ways to pivot&lt;/h2&gt;
&lt;h3&gt;Tags as columns&lt;/h3&gt;
&lt;p&gt;Even though it’s the most common way to pivot, fields are not the only thing you can flip up into column headers. Suppose you want to compare values not against different fields, but against the same field from different sources. For example, if you want to compare readings from different server hosts taken at the same time.&lt;/p&gt;

&lt;p&gt;In our previous example, our data had a tag called &lt;code class="language-javascript"&gt;host&lt;/code&gt; that contained this value.&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;table&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_measurement*&lt;/td&gt;
&lt;td class="tb-yellow fnt500"&gt;_field*&lt;/td&gt;
&lt;td class="tb-yellow"&gt;_value&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_start*&lt;/td&gt;
&lt;td class="tb-grey fnt500"&gt;_stop*&lt;/td&gt;
&lt;td class="tb-grey"&gt;_time&lt;/td&gt;
&lt;td class="tb-blue fnt500"&gt;host*&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field1&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;123&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lblue"&gt;myhost1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field1&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;456&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lblue"&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field2&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;789&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lblue"&gt;myhost1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;mydata&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field2&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;101&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lblue"&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If we wanted to combine the values of each field from all of our hosts into a single record, we could do that with:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;|&amp;gt; group()
  |&amp;gt; pivot(rowKey:["_time", "_field"], columnKey: ["host"], valueColumn: "_value")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first line re-groups our data because InfluxDB by default will put values from different hosts (or any difference in tag values) into separate result tables. Since &lt;code&gt;pivot&lt;/code&gt; works on one result table at a time, we have to call &lt;code class="language-javascript"&gt;group&lt;/code&gt; first to put the values from both hosts into a single table, then we can pivot that combined table around the &lt;code&gt;host&lt;/code&gt; values.&lt;/p&gt;

&lt;p&gt;This query gives us a table structure that looks like this:&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;table&lt;/td&gt;
&lt;td class="tb-yellow"&gt;_field&lt;/td&gt;
&lt;td class="tb-grey"&gt;_start&lt;/td&gt;
&lt;td class="tb-grey"&gt;_stop&lt;/td&gt;
&lt;td class="tb-grey"&gt;_time&lt;/td&gt;
&lt;td class="tb-blue"&gt;myhost1&lt;/td&gt;
&lt;td class="tb-blue"&gt;myhost2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field1&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;123&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;456&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td class="tb-lyellow"&gt;field2&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;789&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Combined columns&lt;/h3&gt;
&lt;p&gt;You can also use &lt;code class="language-javascript"&gt;pivot&lt;/code&gt; to combine field names with tag values. Building off the above example, suppose you want to see the values of both &lt;code class="language-javascript"&gt;field1&lt;/code&gt; and &lt;code class="language-javascript"&gt;field2&lt;/code&gt; for each host in a single row?&lt;/p&gt;

&lt;p&gt;We can do that with a slight modification to our previous function call:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;|&amp;gt; group()
  |&amp;gt; pivot(rowKey:["_time"], columnKey: ["host", "_field"], valueColumn: "_value")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By moving the &lt;code class="language-javascript"&gt;_field&lt;/code&gt; data from the &lt;code class="language-javascript"&gt;rowKey&lt;/code&gt; to the &lt;code class="language-javascript"&gt;columnKey&lt;/code&gt;, along with the &lt;code class="language-javascript"&gt;host&lt;/code&gt; data, we get a table that combines both into unique columns.&lt;/p&gt;
&lt;table class="tb-pivot-data"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tb-grey"&gt;table&lt;/td&gt;
&lt;td class="tb-grey"&gt;_start&lt;/td&gt;
&lt;td class="tb-grey"&gt;_stop&lt;/td&gt;
&lt;td class="tb-grey"&gt;_time&lt;/td&gt;
&lt;td class="tb-green"&gt;myhost1_field1&lt;/td&gt;
&lt;td class="tb-green"&gt;myhost1_field2&lt;/td&gt;
&lt;td class="tb-green"&gt;myhost2_field1&lt;/td&gt;
&lt;td class="tb-green"&gt;myhost2_field2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&amp;lt;query_start&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;query_stop&amp;gt;&lt;/td&gt;
&lt;td&gt;&amp;lt;data_tstamp&amp;gt;&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;123&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;789&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;456&lt;/td&gt;
&lt;td class="tb-lgreen"&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="https://docs.influxdata.com/flux/v0.x/stdlib/universe/pivot/"&gt;pivot() function&lt;/a&gt;: The reference documentation on the pivot() function.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/fieldsascols/"&gt;schema.fieldsAsCol() function&lt;/a&gt;: The reference documentation on the fieldsAsCol() function from the schema package.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://docs.influxdata.com/influxdb/cloud/query-data/flux/group-data/"&gt;group() function&lt;/a&gt;: The reference documentation on the group() function.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/blog/tldr-influxdb-tech-tips-multiple-aggregations-yield-flux/"&gt;TL;DR InfluxDB Tech Tips: Multiple Aggregations with yield() in Flux&lt;/a&gt;: This post teaches you how to use multiple yield().&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/blog/tldr-influxdb-tech-tips-aggregating-across-tags-or-fields-and-ungrouping/"&gt;TL;DR InfluxDB Tech Tips &amp;ndash; Aggregating across Tags or Fields and Ungrouping&lt;/a&gt;: This post teaches how to use group() to combine result tables.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Tue, 12 Oct 2021 04:00:33 -0700</pubDate>
      <link>https://www.influxdata.com/blog/how-to-pivot-data-flux-columnar-data/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/how-to-pivot-data-flux-columnar-data/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>Flux Aggregation in InfluxDB: Now or Later</title>
      <description>&lt;p&gt;Aggregations are a powerful tool when processing large amounts of time series data. In fact, most of the time you’re going to care more about the &lt;code class="language-javascript"&gt;min&lt;/code&gt;, &lt;code class="language-javascript"&gt;max&lt;/code&gt;, &lt;code class="language-javascript"&gt;mean&lt;/code&gt;, &lt;code class="language-javascript"&gt;count&lt;/code&gt; or &lt;code class="language-javascript"&gt;last&lt;/code&gt; values of your dataset than you will about the raw values you’re collecting.&lt;/p&gt;

&lt;p&gt;Knowing this, &lt;a href="https://www.influxdata.com/products/influxdb/"&gt;InfluxDB&lt;/a&gt; and the &lt;a href="https://www.influxdata.com/products/flux/"&gt;Flux&lt;/a&gt; language make it as easy as possible to run these aggregations, whenever and wherever you need to, and sometimes that leads people to running them in ways that aren’t as efficient as they could be. Here are some ways to ensure your aggregation query runs as fast as possible.&lt;/p&gt;
&lt;h2&gt;Don't aggregate too early&lt;/h2&gt;
&lt;p&gt;As great as aggregate functions are and as much as you want to use them, be careful not to use them too soon. Oftentimes, we’ll see somebody with a query like this:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;from(bucket: "myBucket")
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "cpu")
  |&amp;gt; aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["host"] == "myHost")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["cpu"] == "cpu-total")
  |&amp;gt; yield(name: "mean")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While this query will return the exact results you want, in this case the average total CPU for a specific host, it’s also doing a lot more work than it needs to.&lt;/p&gt;

&lt;p&gt;Because the &lt;code class="language-javascript"&gt;aggregateWindow&lt;/code&gt; function is being called before the &lt;code class="language-javascript"&gt;filter&lt;/code&gt; calls on host and cpu, InfluxDB ends up calculating the average for &lt;em&gt;&lt;strong&gt;all&lt;/strong&gt;&lt;/em&gt; host and cpu values first, and then dropping the raw data after it’s done all that hard work.&lt;/p&gt;

&lt;p&gt;Instead, perform all the filtering you can &lt;em&gt;&lt;strong&gt;before&lt;/strong&gt; &lt;/em&gt;using an aggregate function. This reduces the total amount of data going into those calculations, which will give your query a big speed boost especially on large data sets.&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;from(bucket: "myBucket")
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "cpu")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["host"] == "myHost")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["cpu"] == "cpu-total")
  |&amp;gt; aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |&amp;gt; yield(name: "mean")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can still filter data after calling an aggregate, which is useful when you want to filter on the results of the aggregation. But for filters that only check the raw data in your bucket, it’s always best to apply them first. In fact, that’s what the InfluxDB UI’s query builder does automatically!&lt;/p&gt;
&lt;h2&gt;Don't aggregate too late either&lt;/h2&gt;
&lt;p&gt;While you don’t want to get ahead of your data when it comes to aggregation, it’s also possible to call them too late in your query, resulting in a slower response time. For example:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;from(bucket: "myBucket")
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "cpu")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["host"] == "myHost")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["cpu"] == "cpu-total")
  |&amp;gt; pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |&amp;gt; last(column: "_time")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Again this will do what you want: give you the last value of every field in the matching series presented as a single row with fields as columns. However this query will have InfluxDB doing the &lt;code class="language-javascript"&gt;pivot&lt;/code&gt; on the entire data set only to once again throw away that hard work immediately afterwards.&lt;/p&gt;

&lt;p&gt;Here it is better to call the &lt;code class="language-javascript"&gt;last&lt;/code&gt; aggregate function &lt;em&gt;&lt;strong&gt;before&lt;/strong&gt; &lt;/em&gt;pivoting the data, to reduce the amount of data that has to be transformed to just the data you want in the end.&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;from(bucket: "myBucket")
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "cpu")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["host"] == "myHost")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["cpu"] == "cpu-total")
  |&amp;gt; last(column: "_time")
  |&amp;gt; pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Pushdown opportunities&lt;/h2&gt;
&lt;p&gt;When your Flux query is executed, the first thing it does is read your measurement data from the storage layer of InfluxDB before performing your calculations and transformations on that data in memory. Some of those steps can be performed by the storage layer instead, meaning less data being read into memory to begin with.&lt;/p&gt;

&lt;p&gt;When this happens we call it “pushing down” those steps to the layer below Flux, the storage engine layer, and query patterns that can do this are called &lt;a href="https://docs.influxdata.com/influxdb/v2.0/query-data/optimize-queries/#start-queries-with-pushdowns"&gt;pushdown patterns&lt;/a&gt;. Not only do these result in less data being read into memory, they reduce the amount of work the Flux engine has to do.&lt;/p&gt;

&lt;p&gt;The first and most basic pushdown pattern is the common &lt;code class="language-javascript"&gt;from() |&amp;gt; range() |&amp;gt; filter()&lt;/code&gt; that most Flux queries use. If you can put your aggregate function immediately after one of these, &lt;a href="https://docs.influxdata.com/influxdb/v2.0/query-data/optimize-queries/#pushdown-functions-and-function-combinations"&gt;some of them&lt;/a&gt; can also be pushed down to the storage layer. Let’s take a look at our last query:&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-javascript"&gt;from(bucket: "myBucket")
  |&amp;gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |&amp;gt; filter(fn: (r) =&amp;gt; r["_measurement"] == "cpu")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["host"] == "myHost")
  |&amp;gt; filter(fn: (r) =&amp;gt; r["cpu"] == "cpu-total")
  |&amp;gt; last(column: "_time")
  |&amp;gt; pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because we put the &lt;code class="language-javascript"&gt;last&lt;/code&gt; function immediately after a &lt;code class="language-javascript"&gt;from() |&amp;gt; range() |&amp;gt; filter()&lt;/code&gt; pattern, it will also be pushed down to the storage layer. This means the only data that will actually be read into the Flux runtime is the last values of our cpu measurement for the selected series, and the only step executed in memory is the pivot step at the end. If we had left it calling &lt;code class="language-javascript"&gt;last&lt;/code&gt; after the &lt;code class="language-javascript"&gt;pivot&lt;/code&gt;, not only would all of that extra data have to be read into memory, but both the &lt;code class="language-javascript"&gt;pivot&lt;/code&gt; and &lt;code class="language-javascript"&gt;last&lt;/code&gt; functions would have been executed in the Flux layer.&lt;/p&gt;
&lt;h2&gt;Putting it all together&lt;/h2&gt;
&lt;p&gt;So to recap, aggregation is great and Flux is really good at it, and you can make it work better for you by doing as much filtering as possible before applying the aggregation, waiting on performing any transformations of the data until after the aggregation, and keeping an eye out for opportunities to use pushdown patterns that let the storage layer do more of the heavy lifting.&lt;/p&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/blog/top-5-hurdles-for-flux-beginners-and-resources-for-learning-to-use-flux/"&gt;Top 5 Hurdles for Flux Beginners and Resources for Learning to Use Flux&lt;/a&gt;: This post describes common hurdles for Flux beginners and how to tackle them by using the InfluxDB UI, understanding Annotated CSV, and more.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/blog/top-5-hurdles-for-intermediate-flux-users-and-resources-for-optimizing-flux/"&gt;Top 5 Hurdles for Intermediate Flux Users and Resources for Optimizing Flux&lt;/a&gt;: This post describes common hurdles for intermediate and advanced Flux users while providing more detail on pushdown patterns, how the Flux engine works, and more.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/blog/tldr-influxdb-tech-tips-aggregating-across-tags-or-fields-and-ungrouping/"&gt;TL;DR InfluxDB Tech Tips &amp;ndash; Aggregating across Tags or Fields and Ungrouping&lt;/a&gt;: This post describes how grouping affects your table stream and how to aggregate across tags and fields.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Fri, 10 Sep 2021 04:00:06 -0700</pubDate>
      <link>https://www.influxdata.com/blog/flux-aggregation-influxdb-now-or-later/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/flux-aggregation-influxdb-now-or-later/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>InfluxData Community Awards</title>
      <description>&lt;p&gt;We at InfluxData are pleased to announce that we’re once again going to be giving out Community Awards to those who have made significant contributions to our products or community over the past year.&lt;/p&gt;

&lt;p&gt;If somebody has helped you answer a question, solve a problem, or has built something cool and interesting that you think deserves some extra recognition, go and nominate them for an award now!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.influxdays.com/influxdata-community-awards/"&gt;Learn more&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Previous Community Awards&lt;/h2&gt;
&lt;p&gt;The past 18 months have been quite a change for all of us, and with our normally in-person conference InfluxDays going virtual we wanted a way to give a little bit of extra focus on the people in the community who have been helping both InfluxData staff and InfluxDB users online over that time.&lt;/p&gt;

&lt;p&gt;That led us to &lt;a href="https://www.influxdata.com/blog/influxdata-announces-winners-of-inaugural-community-awards/"&gt;introducing the InfluxData Community Awards&lt;/a&gt; as a way for our staff and users to say “thank you” to the people who are helping to make our products and our community better. Award winners get a beautiful, personalized trophy highlighting their contribution, and more importantly the recognition and appreciation of the whole community.&lt;/p&gt;

&lt;p&gt;&lt;img class="alignnone wp-image-258076 aligncenter" src="/images/legacy-uploads/influxdata-community-awards-trophy.jpg" alt="influxdata community awards trophy" width="434" height="766" /&gt;&lt;/p&gt;

&lt;p&gt;Last year’s award winners have continued their contributions, with some even taking on larger roles. One joined the inaugural Telegraf Maintainers team, a joint project between InfluxData and community contributors to maintain and develop the Telegraf project together. The Founder’s Choice winner even took a career change and joined us here at InfluxData to continue helping our users full-time!&lt;/p&gt;
&lt;h2&gt;2021 Community Award nominations&lt;/h2&gt;
&lt;p&gt;Now another year has gone by and we want to again recognize our community contributors, so we’re seeking nominations for the following award categories:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;InfluxDB - For general contribution to InfluxDB itself, including the UI, deployment configurations, documentation or tutorials&lt;/li&gt;
 	&lt;li&gt;Telegraf - For contributing bug fixes, new features, plugins, documentation or tutorials&lt;/li&gt;
 	&lt;li&gt;Flux Language - For contributing to the design and implementation of Flux, improvements to the language, extensions, documentation or tutorials&lt;/li&gt;
 	&lt;li&gt;Community - For providing community support, events, engagement, promotions or any other activity that has helped us grow our global community&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Anybody in the community can be nominated, and anybody in the community (or InfluxData) can nominate somebody. You can even nominate multiple people, for the same category or different ones. Once the nomination period closes on September 30th, the results will be reviewed and winners selected by InfluxData staff.&lt;/p&gt;
&lt;h2&gt;Submit a nomination today!&lt;/h2&gt;
&lt;p&gt;This is your chance to really say “thank you” and recognize somebody for the work they’ve done or help they’ve given you. Nominations have already started coming in, and we will be taking more up until September 30th, so go make your nominations now!&lt;/p&gt;

&lt;p&gt;Don’t forget to &lt;a href="https://www.influxdays.com/influxdays-north-america-2021-virtual-experience/"&gt;register for your free spot for InfluxDays North America&lt;/a&gt; so you can see the winners announced live on October 27, 2021! See you there!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.influxdays.com/influxdata-community-awards/"&gt;Submit nomination&lt;/a&gt;.&lt;/p&gt;
</description>
      <pubDate>Tue, 24 Aug 2021 02:00:21 -0700</pubDate>
      <link>https://www.influxdata.com/blog/influxdata-community-awards/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/influxdata-community-awards/</guid>
      <category>Use Cases</category>
      <category>Developer</category>
      <category>Company</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>InfluxDB Latest Tag Updated in Docker Hub</title>
      <description>&lt;p&gt;The latest InfluxDB OSS (version 2.0.4) has officially been released on &lt;a href="https://hub.docker.com/_/influxdb"&gt;Docker Hub&lt;/a&gt;! While this will allow a smooth upgrade path for both new and existing users of InfluxDB, we found out that some users were being unexpectedly upgraded to the new images due to having configured their deployments to always use the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag of these images.&lt;/p&gt;

&lt;p&gt;In our effort to ensure the best experience possible, we’ve documented here what happened to cause this, how to avoid it, and what to do if you’ve found yourself in a similar situation.&lt;/p&gt;
&lt;h2&gt;What happened&lt;/h2&gt;
&lt;p&gt;Over the past several weeks, we have been working with Docker Hub to update their official InfluxDB images to the new InfluxDB OSS 2.0 release. The final step in that process was updating the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag reference to point to the new InfluxDB 2.0.4 version of the container image. That update was accepted by Docker Hub a couple of days ago, and went live later that night. Since then, anybody who pulled a copy of the image, either using the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag explicitly or using no tag at all, started using the InfluxDB 2.0.4 image.&lt;/p&gt;

&lt;p&gt;This came as a surprise to some users, who were updating an environment that was originally deployed with the InfluxDB 1.8 version of the container, and now found themselves running InfluxDB 2.0 — especially because their data files from InfluxDB 1.8.x are not compatible with the InfluxDB 2.0 codebase.&lt;/p&gt;

&lt;p&gt;If this happened to you, don’t worry, &lt;strong&gt;YOUR DATA IS SAFE!&lt;/strong&gt; InfluxDB OSS has built-in migration tooling to update your data files to the new format, but it will not be run automatically. Depending on your setup, you can either go back to the InfluxDB OSS 1.8 version of the Docker image, or run the command to upgrade your data to work with the latest version. For a list of key differences between InfluxDB 1.x and InfluxDB 2.x, please check out &lt;a href="https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/"&gt;our documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The next section will explain in more detail why this happened and what we’re going to do going forward to help our users avoid it. If you just want to fix your setup and get back to work, scroll down to the “&lt;a href="#howto-fix"&gt;How to Fix It&lt;/a&gt;” section&lt;/p&gt;
&lt;h2&gt;Why this happened&lt;/h2&gt;
&lt;p&gt;The &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag is a &lt;a href="https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375"&gt;convenience&lt;/a&gt; provided by Docker Hub that makes it easy to pull the most up to date version of an image without having to know what that version is. It’s useful for automating things like CI where you always want to use the most recent version of your software, and for developers who just want to get started running your software as quickly and easily as possible.&lt;/p&gt;

&lt;p&gt;As the default when no tag is specified, it also allows for shorter instructions such as &lt;code class="language-bash"&gt;docker run influxdb&lt;/code&gt;, which we can put in our documentation and not have to update every time the release version changes.&lt;/p&gt;

&lt;p&gt;However, it is NOT meant to be used for deployments, since the version it refers to will constantly be changing. The official Kubernetes instructions warn against this use explicitly:&lt;/p&gt;
&lt;blockquote&gt;"You should avoid using the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag when deploying containers in production as it is harder to track which version of the image is running and more difficult to roll back properly."

&lt;a href="https://kubernetes.io/docs/concepts/configuration/overview/#container-images"&gt;https://kubernetes.io/docs/concepts/configuration/overview/#container-images&lt;/a&gt;&lt;/blockquote&gt;
&lt;p&gt;Even if you are only deploying a personal or hobby project you should only use &lt;code class="language-bash"&gt;:latest&lt;/code&gt; in your development and testing environment, and switch to an explicit release tag once you’ve got it working the way you want.&lt;/p&gt;
&lt;h2&gt;Going forward&lt;/h2&gt;
&lt;p&gt;The &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag for InfluxDB currently points to the 2.0.4 release images. As we release new versions of InfluxDB OSS 2.x and beyond, this tag will be updated to point to those new versions. This is how Docker Hub intends for the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag to be used, and is the expected behavior among users.&lt;/p&gt;

&lt;p&gt;We will also continue to publish docker images for the 1.x codebase, and will put out new images for each new release of that codebase. These images, however, will never again have the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag pointing to them, so you will need to give the specific version tag every time you want to run or update them.
&lt;span id="howto-fix"&gt;&lt;/span&gt;
We have identified several places where we can improve our documentation, both on our site and in Docker Hub, to be more explicit about when the &lt;code class="language-bash"&gt;:latest&lt;/code&gt; tag should be used, and when a specific version should be given instead. We will also add more documentation on how to upgrade your Docker environment from InfluxDB 1.8 images to influxDB 2.0 images.&lt;/p&gt;
&lt;h2&gt;How to fix it&lt;/h2&gt;
&lt;p&gt;If you have existing data from your InfluxDB OSS 1.8 deployment, you can either upgrade that to work with the latest InfluxDB OSS 2.0 release, or roll your deployment back to using the InfluxDB OSS 1.8 release.&lt;/p&gt;
&lt;h3&gt;Upgrade to InfluxDB OSS 2.0&lt;/h3&gt;
&lt;p&gt;If you want to stay on InfluxDB OSS 2.0, you can do an in-place upgrade of your existing data using the new version of the InfluxDB image. To do that, you will need to run your container with some additional environment variables set, these will tell InfluxDB OSS 2.0 that you want to upgrade your data and configuration files. We have &lt;a href="https://hub.docker.com/_/influxdb"&gt;updated the instructions&lt;/a&gt; on the InfluxDB Docker Hub page to walk you through this process.&lt;/p&gt;
&lt;h3&gt;Rollback to InfluxDB OSS 1.8&lt;/h3&gt;
&lt;p&gt;If you’d rather just get everything back to how it was before this happened, all you need to do is tell docker to use the &lt;code class="language-bash"&gt;1.8&lt;/code&gt; tag explicitly.&lt;/p&gt;

&lt;p&gt;In the Docker CLI, you can do this with:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-bash"&gt;docker run --rm influxdb:1.8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you are using docker-compose, add the &lt;code class="language-bash"&gt;1.8&lt;/code&gt; tag to the &lt;code class="language-bash"&gt;image:&lt;/code&gt; parameter in your docker-compose.yml:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-yaml"&gt;image: influxdb:1.8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Likewise if you are using Kubernetes, update your pod spec to use:&lt;/p&gt;

&lt;p&gt;&lt;code class="language-yaml"&gt;image: influxdb:1.8&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;Acknowledgements&lt;/h2&gt;
&lt;p&gt;Lastly I’d like to thank &lt;a href="https://www.influxdata.com/blog/community-showcase/influxaces/matt-iverson/"&gt;Matthew Iverson&lt;/a&gt;, an InfluxDB customer and one of our community &lt;a href="https://www.influxdata.com/community-showcase/influxaces/"&gt;InfluxAces&lt;/a&gt;, who let us know that this tag update was causing confusion among users of our open source release, even though it didn’t affect him directly. I’d also like to thank Srajan Bhagat in our Customer Success team, who passed Matthew’s message on to me immediately after hearing it.&lt;/p&gt;

&lt;p&gt;And I would especially like to thank the InfluxData Product and Engineering teams, in particular Phillip Steinbachs, Daniel Moran, Russ Savage, Jonathan Sternberg and Ryan Betts, who all dropped what they were doing and jumped onto calls with me to help find a resolution as soon as I said that our open source users were having an issue. Their commitment to ensuring the best possible experience for all of our users is what makes InfluxData and the InfluxDB community so great.&lt;/p&gt;

&lt;p&gt;As always, you can connect with us directly in the InfluxData community by &lt;a href="https://influxdata.com/slack/"&gt;joining our Slack&lt;/a&gt; or &lt;a href="https://community.influxdata.com/"&gt;visiting our forums&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Resource links&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="https://hub.docker.com/_/influxdb"&gt;InfluxDB on Docker Hub&lt;/a&gt;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/"&gt;Upgrading from InfluxDB OSS 1.x to InfluxDB OSS 2.0&lt;/a&gt;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://www.influxdata.com/community-showcase/influxaces/"&gt;InfluxAces Program&lt;/a&gt;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://influxdata.com/slack/"&gt;InfluxData Community Slack&lt;/a&gt;&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://community.influxdata.com/"&gt;InfluxData Community Forums&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Fri, 26 Feb 2021 12:32:47 -0700</pubDate>
      <link>https://www.influxdata.com/blog/influxdb-latest-tag-updated-in-docker-hub/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/influxdb-latest-tag-updated-in-docker-hub/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>Save the Date: InfluxDays Virtual Experience is Coming Back November 10-11, 2020</title>
      <description>&lt;p&gt;&lt;img class="alignnone size-full wp-image-249979 aligncenter" src="/images/legacy-uploads/influxdays-virtual-2020.png" alt="influxdays virtual 2020" width="937" height="359" /&gt;&lt;/p&gt;

&lt;p&gt;2020 has been one crazy year! Like so many tech communities, we had planned for an exciting year filled with travel, conferences, and talking to people in person only to have all of those plans upended by the COVID-19 pandemic. InfluxData has traditionally hosted InfluxDays, the industry’s premier conference dedicated to time series data, twice a year in Europe and North America. Even though we can’t hold our editions in-person, we weren’t going to let that stop us from bringing you the kind of content and networking opportunities that you’ve come to rely on.&lt;/p&gt;
&lt;h2&gt;From in-person to virtual&lt;/h2&gt;
&lt;p&gt;We held our first InfluxDays Virtual Experience back in June, taking the place of what was originally going to be an in-person event in London. With only a few months to prepare for the change, we were not only able to hold the event successfully online, but with a record turnout of nearly a thousand people watching and interacting with our speakers live. The people who came to watch the InfluxDays sessions have remained active in our &lt;a href="https://w2.influxdata.com/slack"&gt;Slack&lt;/a&gt; and &lt;a href="https://community.influxdata.com"&gt;Discourse&lt;/a&gt;, learning from, helping and making connections with others in the community. Our speakers were engaging, their talks ranged from high level to deeply technical, and in some cases the sessions were quite literally on fire!&lt;/p&gt;

&lt;p&gt;&lt;img class="wp-image-249962 size-full" src="/images/legacy-uploads/influxdays-2020.png" alt="influxdays 2020" width="941" height="465" /&gt;&amp;lt;figcaption&amp;gt; Daniel Putz presented the &lt;a href="https://youtu.be/7w8sejbc7kg"&gt;History of Monitoring at Volvo Cars&lt;/a&gt; at InfluxDays London 2020 Virtual Experience&amp;lt;/figcaption&amp;gt;&lt;/p&gt;
&lt;h2&gt;Our next conference edition&lt;/h2&gt;
&lt;p&gt;Now we’re taking everything we’ve learned from all of our past InfluxDays, including that first Virtual Experience, and using that to make our next InfluxDays even better. On November 10th and 11th, we have another lineup of amazing speakers with both live and on-demand sessions, who will tell you all about the new InfluxDB 2.0, the ecosystem around it and what we have in store for the future. As always, InfluxDays will be kicked-off by Paul Dix, our CTO and the creator of InfluxDB, along with a selection of speakers from InfluxData as well as our wider ecosystem who will be there to tell you about the innovations happening in and around InfluxDB, Telegraf and Flux.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.influxdays.com/virtual-experience-2020/register-virtual-conference/"&gt;Registration for InfluxDays North America is now open&lt;/a&gt; and once again free for all attendees! Whether you’ll be attending for the first time or coming back again for more, I look forward to seeing you all there!&lt;/p&gt;

&lt;p&gt;Can’t wait for InfluxDays in November? We will be holding a virtual edition of our hands-on &lt;a href="https://www.influxdays.com/virtual-experience-2020/flux-training/"&gt;Flux Training&lt;/a&gt; October 27th-28th with limited seating available. You can also start talking to us today by &lt;a href="https://w2.influxdata.com/slack"&gt;joining our community chat&lt;/a&gt;!&lt;/p&gt;
</description>
      <pubDate>Wed, 02 Sep 2020 06:00:38 -0700</pubDate>
      <link>https://www.influxdata.com/blog/save-the-date-influxdays-virtual-experience-is-coming-back-november-10-11-2020/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/save-the-date-influxdays-virtual-experience-is-coming-back-november-10-11-2020/</guid>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>Become an InfluxDB Inventor</title>
      <description>&lt;p&gt;As &lt;a href="/products/influxdb-overview/"&gt;InfluxDB&lt;/a&gt; continues to grow and improve, more and more developers are using it as the platform of choice for their own solutions. Most of these solutions range from filling niche internal needs to solving common problems faced by entire industries, but some of them are extraordinary for their impact, innovation, or how much they push the boundaries of what is possible with the technology. In order to recognize those, we are launching the &lt;strong&gt;InfluxDB Inventors&lt;/strong&gt; program.&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/legacy-uploads/influxdb-inventor-program-logo.png" alt="influxdb inventor program logo" width="280" height="362" /&gt;&lt;/p&gt;

&lt;h2&gt;Program eligibility and two types of inventors&lt;/h2&gt;

&lt;p&gt;Anybody who builds something with, or on top of, InfluxDB is eligible to become an InfluxDB Inventor. We will specifically look for two types of Inventors: those who pioneer the use of some new product or feature of InfluxDB, and those who create something novel and impactful that we haven’t even considered before.&lt;/p&gt;

&lt;p&gt;For the first group, we will define specific challenges or milestones that need to be met in order to qualify and will place a cap on the number of people who can become an InfluxDB Inventor by meeting that challenge. The purpose of this approach is to push forward the cutting edge parts of the InfluxDB platform and recognize those innovators who help us improve both the technology and the developer experience behind it.&lt;/p&gt;

&lt;p&gt;But we also know that innovation isn’t limited to just what we can think of. That’s why the second group allows for InfluxDB Inventors to be &lt;a href="https://docs.google.com/forms/d/e/1FAIpQLSfxjR8MdqYQNqfqcNWzRue05vxc8T1ha4biAoU7BPCmoNX1cQ/viewform?usp=sf_link"&gt;nominated by anyone in our community&lt;/a&gt;, for any solution they feel is deserving of that recognition. These nominations will be reviewed by the InfluxDB Community team for approval based on the creativity, impact, and experience that their solutions provide. There is no limit to the number of people who can become InfluxDB Inventors this way. We have an amazingly creative community, and we plan to recognize as many of them with this program as we can.&lt;/p&gt;

&lt;h2&gt;InfluxDB Inventor recognition and benefits&lt;/h2&gt;

&lt;p&gt;The biggest prize an InfluxDB Inventor gets is the recognition of the value and impact of their work — both from InfluxData and the community at large —  but Inventors will also receive some special benefits. Every InfluxDB Inventor will receive an exclusive InfluxDB Inventor t-shirt available exclusively through this program — you can’t purchase these, and they won’t be given away at conferences.&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/legacy-uploads/influxdb-inventor-t-shirt.png" alt="influxdb inventor t-shirt" width="429" height="513" /&gt;&lt;/p&gt;

&lt;p&gt;Each InfluxDB Inventor, as well as their invention(s), will also be listed in an InfluxDB Inventors Directory on our website. We will also send you a Certificate of Invention, signed by InfluxData founder and CTO Paul Dix, so you can display your accomplishment in your home or office.&lt;/p&gt;

&lt;p&gt;As part of our kickoff of the InfluxDB Inventors, we’ve chosen the &lt;a href="/products/influxdb-templates/"&gt;InfluxDB Templates&lt;/a&gt; as our first technology focus.&lt;/p&gt;

&lt;p&gt;&lt;img src="/images/legacy-uploads/influxdb-templates-influxdb-inventor.png" alt="InfluxDB Templates - InfluxDB inventor" width="1163" height="563" /&gt;&lt;/p&gt;
&lt;figcaption&gt; InfluxDB Templates allow you to create and share a comprehensive monitoring solution.&lt;/figcaption&gt;

&lt;p&gt;Launched earlier this year, InfluxDB Templates are a new feature available in InfluxDB 2.0 that allows you to export your entire configuration, from Dashboards to Tasks to Telegraf configurations, into a shareable and reusable format. The first 20 community contributors of an InfluxDB Template that can be reused by anybody will become InfluxDB Inventors! In fact, we already have community contributors who have done this, and who will be the very first Inventors added to this program.&lt;/p&gt;

&lt;p&gt;Our first batch of InfluxDB Inventors t-shirts has been ordered, the directory webpage is being built, and our inaugural class of InfluxDB Inventors has already been selected. The only question remaining is: What will you invent next using InfluxDB technology?&lt;/p&gt;
</description>
      <pubDate>Mon, 15 Jun 2020 06:00:24 -0700</pubDate>
      <link>https://www.influxdata.com/blog/become-an-influxdb-inventor/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/become-an-influxdb-inventor/</guid>
      <category>Company</category>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
    <item>
      <title>Introducing Community InfluxDB Templates</title>
      <description>&lt;p&gt;With InfluxDB 2.0 we added the ability to export a configuration of your entire stack, and import it again into another instance of InfluxDB. This includes your InfluxDB buckets, dashboards, queries, alerts and even Telegraf configurations.&lt;/p&gt;

&lt;p&gt;Since many people have the same or similar use cases, we wanted to provide a way for you to share your configurations with other users, and work together to enhance and improve them over time, just like you would any other open source project. So we’re launching a &lt;a href="https://github.com/influxdata/community-templates"&gt;Community InfluxDB Templates&lt;/a&gt; project where you can publish your templates, see what other InfluxDB users have built, and try their templates yourself!&lt;/p&gt;

&lt;p&gt;We’ve made using a Template as easy as possible, with just a few commands you’ll have everything you need up and running. You can try it now on either the &lt;a href="https://cloud2.influxdata.com/login"&gt;InfluxDB Cloud&lt;/a&gt; or by &lt;a href="https://portal.influxdata.com/downloads/"&gt;downloading&lt;/a&gt; and running InfluxDB 2.0 yourself.&lt;/p&gt;
&lt;h2&gt;Setting up your environment&lt;/h2&gt;
&lt;p&gt;In this article I’ll be using the &lt;a href="https://w2.influxdata.com/influxdb-cloud-pricing/"&gt;InfluxDB Cloud free tier&lt;/a&gt; to walk through using a Template. Using this hosted service is identical to using a self-hosted InfluxDB 2.0 instance, with just a couple of exceptions. First, the hosted service gives you a default Organization name, which will be the email address you used to sign up. Second, the hosted service doesn’t create an &lt;strong&gt;All Access&lt;/strong&gt; token for you at the start, and you’ll need one in order to apply and use a Template.&lt;/p&gt;

&lt;p&gt;To create a token, log into your InfluxDB Cloud instance and go to the &lt;strong&gt;Load Data&lt;/strong&gt; section, and then click the &lt;strong&gt;Tokens&lt;/strong&gt; tab. From there you can create a new &lt;strong&gt;All Access&lt;/strong&gt; token. Be sure not to share this token with anybody you don’t want to have full access to your account! The token I’ll be showing in this article was created just for this demo, and has already been deleted so that it can no longer be used.&lt;/p&gt;

&lt;p&gt;&lt;img class="size-full wp-image-242883 aligncenter" src="/images/legacy-uploads/influxdb-load-data.png" alt="influxdb load data" width="522" height="226" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-size: 16px;"&gt;Next you’ll want to create some environment variables. This isn’t strictly necessary, as you can pass the same information as parameters to the &lt;/span&gt;&lt;strong style="font-size: 16px;"&gt;influx&lt;/strong&gt;&lt;span style="font-size: 16px;"&gt; command-line we’ll be using later, but it’ll save you some typing and make it easier to follow along if we set them at environment variables instead. Here’s what mine look like:&lt;/span&gt;&lt;/p&gt;
&lt;pre class="line-numbers"&gt;&lt;code class="language-ini"&gt;export INFLUX_HOST=https://us-west-2-1.aws.cloud2.influxdata.com 
export INFLUX_ORG=mhall@influxdata.com 
export INFLUX_TOKEN=MEMHwunGerdCRFG1_9Yi_GLpvGC3sr03DV1lUuvevhHJ88mqS5I7JmkyjlpMVpCDFv8Lf7rNq6MhUiavNw7Ceg==&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that my &lt;strong&gt;INFLUX_HOST&lt;/strong&gt; is the us-west-2 zone on Amazon AWS. When you sign up for InfluxDB Cloud, you’ll be asked to pick where you want to run it. You can use any of the available options, and can find the proper value for this variable under the &lt;strong&gt;Load Data&lt;/strong&gt; &amp;gt; &lt;strong&gt;Client Libraries&lt;/strong&gt; section of the UI.&lt;/p&gt;

&lt;p&gt;&lt;img class="size-full wp-image-242884 aligncenter" src="/images/legacy-uploads/influxdb-load-data-client-libraries.png" alt="InfluxDB load data client libraries" width="953" height="326" /&gt;&lt;/p&gt;
&lt;h2&gt;Pick your Template&lt;/h2&gt;
&lt;p&gt;The Community InfluxDB Templates repository provides a list of the available template. One of the simplest ones to start with is the &lt;a href="https://github.com/influxdata/community-templates/tree/master/linux_system" target="_blank" rel="noreferrer noopener" aria-label="Linux System Monitoring (opens in a new tab)"&gt;Linux System Monitoring&lt;/a&gt; template, which will gather a number of system resource metrics from a Linux machine and display them all for you in a nice dashboard.&lt;/p&gt;

&lt;p&gt;&lt;img class="alignnone size-full wp-image-242885 aligncenter" src="/images/legacy-uploads/community-influx-templates-example.png" alt="community influx templates example" width="1024" height="489" /&gt;&lt;/p&gt;
&lt;h2&gt;Apply the Template&lt;/h2&gt;
&lt;p&gt;Since we’ve already set our environment variables, the only thing we need to specify on the command-line is the location of the Template file. If you’ve cloned the Git repository with all of the Templates in it, you can point to the manifest file like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-ini"&gt;influx pkg --file ~/Projects/community-templates/linux_system/linux_system.yml&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But an even easier way is to skip cloning, and just point directly to the manifest file on Github using the &lt;strong&gt;–url&lt;/strong&gt; parameter like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-ini"&gt;influx pkg --url https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will read the Template file and present you with a list of changes it will make to your InfluxDB setup before applying it. This gives you the chance to review what the Template is going to do before it makes any changes.&lt;/p&gt;

&lt;p&gt;&lt;img class="size-full wp-image-242880 aligncenter" src="/images/legacy-uploads/community-influx-templates-screenshot.png" alt="community influx templates" width="912" height="297" /&gt;&lt;/p&gt;

&lt;p&gt;Once you confirm that you want to make those changes, it will create all the specified resources for you. That’s all you need to do!&lt;/p&gt;
&lt;h2&gt;Running Telegraf configurations&lt;/h2&gt;
&lt;p&gt;While the above instructions created your dashboard and supporting resources, you’ll notice that there’s no data there yet. That’s because the Linux System Monitor Template, like most Templates, uses Telegraf to read data from some source and write it into InfluxDB. But running Telegraf from a Template is easy too, because the configuration is part of it!&lt;/p&gt;

&lt;p&gt;&lt;img class="wp-image-242886 aligncenter" src="/images/legacy-uploads/running-telegraf-configurations.png" alt="running Telegraf configurations" width="1228" height="427" /&gt;&lt;/p&gt;

&lt;p&gt;So far you could have run these instructions on any machine you liked. But you’ll need to install run Telegraf on the Linux host you want to monitor.&lt;/p&gt;

&lt;p&gt;Each Template will provide instructions for how to setup and run any additional resources, such as Telegraf. The Linux System Monitor, for example, first tells you to setup your environment variables (the same ones we set above, but this time on the Linux host we’ll be monitoring), and then tells you to get the Telegraf configuration from &lt;strong&gt;Load Data&lt;/strong&gt; &amp;gt; &lt;strong&gt;Telegraf &lt;/strong&gt;as follows:&lt;/p&gt;

&lt;p&gt;&lt;img class="size-full wp-image-242887 aligncenter" src="/images/legacy-uploads/linux-system-telegraf.png" alt="Linux system Telegraf" width="387" height="184" /&gt;&lt;/p&gt;

&lt;p&gt;Because the Telegraf configuration is already in your InfluxDB instance, using them is simply a matter of pointing Telegraf to it. This command will connect to your InfluxDB instance using the credentials in your environment variables, download the Linux System Monitoring configuration, and start Telegraf running with it.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-ini"&gt;telegraf --config https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/telegrafs/05423ced3db76000&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now when you view your Linux System dashboard, you’ll start to see data appearing in your graphs! Be sure to check that your filters at the top are using the right &lt;strong&gt;bucket&lt;/strong&gt; (telegraf) and &lt;strong&gt;linux_host&lt;/strong&gt; (this will come from the host itself). Because the dashboard lets you filter by host, you can run the same Telegraf command on multiple Linux machines and monitor them all through the same dashboard!&lt;/p&gt;

&lt;p&gt;&lt;img class=" wp-image-242888 aligncenter" src="/images/legacy-uploads/linux-system-dashboard-telegraf.png" alt="Linux system dashboard Telegraf" width="1315" height="614" /&gt;&lt;/p&gt;
&lt;h2&gt;Join the InfluxDB Community&lt;/h2&gt;
&lt;p&gt;To learn more about InfluxDB Templates and other community projects, join the &lt;a href="https://w2.influxdata.com/slack"&gt;InfluxDB Community Slack&lt;/a&gt; and &lt;a href="https://community.influxdata.com/"&gt;Forums&lt;/a&gt;. There you will find InfluxData engineers and InfluxDB users working together, sharing ideas, and supporting each other.&lt;/p&gt;
</description>
      <pubDate>Wed, 19 Feb 2020 06:00:57 -0700</pubDate>
      <link>https://www.influxdata.com/blog/introducing-community-influxdb-templates/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/introducing-community-influxdb-templates/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Developer</category>
      <author>Michael Hall (InfluxData)</author>
    </item>
  </channel>
</rss>
