InfluxDB Docs

toInt() function

The toInt() function converts all values in the _value column to integers.

Function type: Type conversion
Output data type: Integer


To convert values in a column other than _value, define a custom function patterned after the function definition, but replace the column in the int() function with your desired column.


from(bucket: "telegraf")
  |> filter(fn:(r) =>
    r._measurement == "mem" and
    r._field == "used"
  |> toInt()

Function definition

toInt = (tables=<-) =>
    |> map(fn:(r) => int(v: r._value))

Used functions: map(), int()