filter() function filters data based on conditions defined in a predicate function (
The output tables have the same schema as the corresponding input tables.
Function type: Transformation
Output data type: Object
filter(fn: (r) => r._measurement == "cpu")
A single argument function that evaluates true or false. Records are passed to the function. Those that evaluate to true are included in the output tables.
Data type: Function
Objects evaluated in
fn functions are represented by
r, short for “record” or “row”.
from(bucket:"telegraf/autogen") |> range(start:-1h) |> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_system" and r.cpu == "cpu-total" )
Related InfluxQL functions and statements:
Bug Reports and Feedback
Thank you for being willing to help test InfluxDB v2.0 alpha! Feedback and bug reports are welcome and encouraged both for InfluxDB and this documentation. Submit feedback using one of the following methods:
- Post in the InfluxData Community
- In the InfluxDB UI, click Feedback in the left navigation bar.