Introduction to Flux

Flux is InfluxData’s new functional data scripting language designed for querying, analyzing, and acting on time series data. Its takes the power of InfluxQL and the functionality of TICKscript and combines them into a single, unified syntax.

Flux v0.7 is a technical preview included with InfluxDB v1.7. It is still in active development and many functions provided by InfluxQL and TICKscript have yet to be implemented.

Flux design principles

Flux is designed to be usable, readable, flexible, composable, testable, contributable, and shareable. Its syntax is largely inspired by 2018’s most popular scripting language, Javascript, and takes a functional approach to data exploration and processing.

The following example illustrates pulling data from a bucket (similar to an InfluxQL database) for the last five minutes, filtering that data by the cpu measurement and the cpu=cpu-usage tag, windowing the data in 1 minute intervals, and calculating the average of each window:

  |> range(start:-1h)
  |> filter(fn:(r) =>
    r._measurement == "cpu" AND
    r.cpu == "cpu-total"
  |> aggregateWindow(every: 1m, fn: mean)

Enable Flux

Flux is packaged with InfluxDB v1.7+ and does not require any additional installation, however it does need to be enabled.

Get started with Flux

The best way to familiarize yourself with Flux is to walk through creating a simple Flux query. The getting started documentation does just that.

This documentation is open source. See a typo? Please, open an issue.

Need help getting up and running? Get Support