Questions tagged [fluxlang]

This tag should be for questions regarding InfluxData's Flux language. Flux is a lightweight scripting language for querying databases (like InfluxDB, Grafana) and working with data.

Flux is InfluxData's new functional data scripting language designed for querying, analyzing, and transforming data.

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.

Github page: https://github.com/influxdata/flux

14 questions
2
votes
1 answer

How to merge (join) two tables in a specific way in Grafana using InfluxDB flux query?

Grafana: 7.1.5 InfluxDB: 1.8 I currently have three separate table panels in Grafana where the only difference between each query is the time range (Year, Month, Day). I would like to combine these three tables into one, where the measurement's…
Shana
  • 71
  • 2
  • 7
2
votes
1 answer

Error 403: "Flux query service disabled." But flux-enabled=true has been set in influxdb.conf

I have been using InfluxDB (server version 1.7.5) with the InfluxQL language for some time now. Unfortunately, InfluxQL does not allow me to perform any form of joins, so I need to use InfluxDB's new scripting language Flux instead. The manual…
1
vote
1 answer

Why is my Flux query in Grafana not sorting by default?

Grafana 7.5.1 with InfluxDB 1.8.2. I'm trying to create a table that displays a sum of the "units" values for each distinct tag value. I am getting the data, but I need the sums to be sorted in descending order by default. This is my Flux query: …
Shana
  • 71
  • 2
  • 7
1
vote
1 answer

How do I "check" (alert on) an aggregate in InfluxDB 2.0 over a rolling window?

I want to raise an alarm when the count of a particular kind of event is less than 5 for the 3 hours leading up to the moment the check is evaluated, but I need to do this check every 15 minutes. Since I need to check more frequently than the span…
billkw
  • 3,350
  • 3
  • 28
  • 32
1
vote
1 answer

Ternary operator in Influx flux

I am doing a join in influx to get the first and last values for a interval and then getting the difference. Preset = 600 FirstValues = from(bucket: "Historian/oneday") |> range(start: dashboardTime) |> filter(fn: (r) => r._measurement ==…
Simsons
  • 12,295
  • 42
  • 153
  • 269
0
votes
0 answers

How to find the values ​of one measurement according to the values ​of another in InfluxDB (Flux)?

I have been doing a lot of research regarding a way to make the query on a measure dependent on the value of another measure on influxDB, however, I cannot find a viable solution, I still have the problem of "No Data" while on the graphs we see that…
LucasG
  • 11
  • 3
0
votes
0 answers

How to compare cumulative counter vs the best, average and worst using Influxdb in Grafana

7 years ago I asked this question on SO: How to compare cumulative counter vs the best, average and worst using Graphite? Fast-forward to today, I'm now trying to do the same with InfluxDB using InfluxQL or the newer Flux. In a nutshell, I want to…
Jerome Provensal
  • 931
  • 11
  • 22
0
votes
2 answers

Is there a way to select value with multiple "tables" like sql on influxdb

Hi is there a way to select a value filtered with multiple parameter with flux language in influx db : Exemple in sql : select val1 from tab1,tab2,tab3 where val2.tab2>30 and val3.tab>6 . Is this possible in flux language ? Thanks For now I only…
LucasG
  • 11
  • 3
0
votes
1 answer

Conditionally assign Flux variable - syntax error

I'm trying to conditionally assign a value to the variable START as part of a Flux query: WINDOW = 1d START = if WINDOW == 1d then today() else 2022-01-01 This results in the following error: unsupported binary expression duration == duration What…
0
votes
1 answer

What is the optimal way to write a flux query with a long list of tag filters?

Say I have an influx measurement that logs a large amount of data. Each point is tagged with a unique id that identifies the source of the data and a type. Example of entries into this measurement: data,id=source1,type=temperature…
0
votes
1 answer

Aggregate by month since start of the month with timezone offset in Flux language

I've filled database (Influxdb 2.0.7) so it contains value of 1 each day in year: _time:time _value:int ------------------------------ -------------------------- 2021-01-01T00:00:00.000000000Z …
Michal Špondr
  • 1,337
  • 2
  • 21
  • 44
0
votes
1 answer

How to escape strings in Flux (influxdb)?

I want to pass a http.post json through a task but I cannot find docs on how to escape a string and I have quotations inside my strings import "json" import "http" from(bucket: "prod") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |>…
ditoslav
  • 4,563
  • 10
  • 47
  • 79
0
votes
1 answer

How to join a string value from a tag with a string value from a field?

consider having the following line protocol data: my_measurement,foo="Some" bar="Thing",baz=123 where foo is a tag and bar and baz are fields, I need to get, say, a string "Some|Thing" out of InfluxDB OSS v2 using the Flux language. What's the…
mjf
  • 498
  • 4
  • 15
0
votes
2 answers

Modifying the series data using flux language in influx

I have a function which takes the 1st value from a masurement every 5mins. ever5Mins1st = from(bucket: "Historian/oneday") |> range(start: dashboardTime) |> filter(fn: (r) => r._measurement == "InventoryStock" and r._field =="Value" …
Simsons
  • 12,295
  • 42
  • 153
  • 269