1.0 KiB
1.0 KiB
title | description | aliases | menu | weight | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
influxFieldsAsCols() function | The influxFieldsAsCols() function is pivots a table and automatically aligns fields within each input table that have the same timestamp. |
|
|
401 |
The influxFieldsAsCols()
function is a special application of the pivot()
function that
automatically aligns fields within each input table that have the same timestamp.
Function type: Transformation
influxFieldsAsCols()
Examples
from(bucket:"telegraf/autogen")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "cpu")
|> influxFieldsAsCols()
|> keep(columns: ["_time", "cpu", "usage_idle", "usage_user"])
Function definition
influxFieldsAsCols = (tables=<-) =>
tables
|> pivot(
rowKey:["_time"],
columnKey: ["_field"],
valueColumn: "_value"
)