diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa2addadc..17dd47c5e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -293,7 +293,7 @@ The shortcode structure is the same as above, but the shortcode names are differ data = from(bucket: "telegraf/autogen") |> range(start: -15m) |> filter(fn: (r) => - r._measurement == "mem" AND + r._measurement == "mem" and r._field == "used_percent" ) ``` diff --git a/content/v2.0/example.md b/content/v2.0/example.md index 373cd75cd..f98ab6638 100644 --- a/content/v2.0/example.md +++ b/content/v2.0/example.md @@ -33,7 +33,7 @@ This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nu data = from(bucket: "telegraf/autogen") |> range(start: -15m) |> filter(fn: (r) => - r._measurement == "mem" AND + r._measurement == "mem" and r._field == "used_percent" ) ``` @@ -442,7 +442,7 @@ This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nu data = from(bucket: "telegraf/autogen") |> range(start: -15m) |> filter(fn: (r) => - r._measurement == "mem" AND + r._measurement == "mem" and r._field == "used_percent" ) ``` diff --git a/content/v2.0/process-data/write-a-task.md b/content/v2.0/process-data/write-a-task.md index 138733095..fda5b49ea 100644 --- a/content/v2.0/process-data/write-a-task.md +++ b/content/v2.0/process-data/write-a-task.md @@ -62,7 +62,7 @@ the required time range and any relevant filters. data = from(bucket: "telegraf/default") |> range(start: -task.every) |> filter(fn: (r) => - r._measurement == "mem" AND + r._measurement == "mem" and r.host == "myHost" ) ``` @@ -111,7 +111,10 @@ to send the transformed data to another bucket: ``` {{% note %}} -You cannot write to the same bucket you are reading from. +#### Important notes +- You cannot write to the same bucket you are reading from. +- In order to write data into InfluxDB, you must have `_time`, `_measurement`, + `_field`, and `_value` columns. {{% /note %}} ## Full example task script @@ -132,7 +135,7 @@ option task = { data = from(bucket: "telegraf/default") |> range(start: -task.every) |> filter(fn: (r) => - r._measurement == "mem" AND + r._measurement == "mem" and r.host == "myHost" ) diff --git a/content/v2.0/reference/flux/functions/built-in/outputs/to.md b/content/v2.0/reference/flux/functions/built-in/outputs/to.md index 3d45cdcf3..dcf42d8b6 100644 --- a/content/v2.0/reference/flux/functions/built-in/outputs/to.md +++ b/content/v2.0/reference/flux/functions/built-in/outputs/to.md @@ -12,8 +12,7 @@ weight: 401 The `to()` function writes data to an **InfluxDB v2.0** bucket. -_**Function type:** Output_ -_**Output data type:** Object_ +_**Function type:** Output_ ```js to( @@ -39,6 +38,18 @@ to( ) ``` +{{% note %}} +### Output data requirements +The `to()` function converts output data into line protocol and writes it to InfluxDB. +Line protocol requires each record to have a timestamp, a measurement, a field, and a value. +All output data must include the following columns: + +- `_time` +- `_measurement` +- `_field` +- `_value` +{{% /note %}} + ## Parameters {{% note %}} `bucket` OR `bucketID` is **required**.