Questions tagged [influxdb-2]

More information here https://v2.docs.influxdata.com/v2.0/. Version 2 uses a new query language called Flux and it is also reactive in nature.

289 questions
1
vote
1 answer

Influxdb 2.x how to get the last field per tag value?

I'm using this query to fetch all the available tag values from the measurement: schema.measurementTagValues( bucket: "XYZ", measurement: "ABC", tag: "test", ) This results in me all the tagValue in measurement ABC. How can I use these…
boyfromnorth
  • 958
  • 4
  • 19
  • 41
1
vote
1 answer

Select Multiple Columns with Flux

My data looks something like this -- I want to create a FLUX query which results into -- SELECT UUID, CUST_ID, PO_NO, TIMESTAMP FROM CUST_PO_DTLS WHERE PO_NO = ? In my Influx DB bucket, UUID, CUST_ID, PO_NO are all fields. Here, I explicitly…
Rahul Bhardwaj
  • 2,303
  • 1
  • 17
  • 28
1
vote
1 answer

How do I limit records for Influx using flux?

I'm new with Influx, and although I can get range, filter, sort and group to work, I just can't get limit to work. I'm using Influx OSS 2.3 and I'd assume the query should look like this: from(bucket: "readings") |> range(start: - 1d) |>…
wmmhihaa
  • 744
  • 8
  • 21
1
vote
2 answers

Drop/Delete measurement InfluxDB 2.x

In influxDB 1.x I could delete/drop any measurement in a simple way: Influx use mydatabase DROP MEASUREMENT measurementname In influxDB 2.x with Flux language, I have not found a straight way to delete/drop a measurement in an equivalent…
FeliceM
  • 4,163
  • 9
  • 48
  • 75
1
vote
2 answers

Calculating average of elapsed time

I want to calculate the average time duration of my events. After an event starts and ends, it sends a request to my InfluxDB in the Line Protocol Syntax: mes1 id=1,event="start" 1655885442 mes1 id=1,event="end" 1655885519 mes1 id=2,event="start"…
1
vote
0 answers

How to use sum only on number field and group by string field, while having both string and number fields in select statement in InfluxDB's FluxQL?

This FLUX Query is resulting in error : sum: unsupported aggregate column type string from(bucket: "Bucket") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "measurement") |> filter(fn: (r) =>…
Nikhil
  • 21
  • 1
  • 2
1
vote
2 answers

What is the query to select multiple columns and group by one of the column in InfluxDb using Flux?

How to write similar query using Flux: SELECT field_a,field_b from 'measurement' where field_a = 10 and group by field_b
1
vote
1 answer

deleting columns from influx DN using flux command line

Is there any way to delete columns of an influx timeseries as we have accidentally injected data using the wrong data type (int instead of float). Or to change the type of data instead.
homer69
  • 53
  • 1
  • 8
1
vote
1 answer

InfluxDB - Get the latest data even if it is not in the time range provided

from(bucket: "metrics") |> range(start: -5m) |> filter(fn: (r) => r["_measurement"] == "cpu") |> filter(fn: (r) => r["_field"] == "usage") |> last() Running this query will return the data only if it was saved in the last 5 minutes. What I am…
1
vote
0 answers

InfluxDB Line Protocol Performance 1.8 vs. 2.0

I noticed that there is a considerable (5x) performance penalty when upgrading my app from InfluxDB 1.8 to 2.0. I'm using ILP and the only change I made on the ingress side was switching from /write to /api/v2/write, adding the auth token and org…
Michael
  • 1,416
  • 1
  • 9
  • 21
1
vote
1 answer

Flux calculate rate per second using sample interval

The following Flux gives me DNS queries per second, but I'd like to not have a static value for the measurement interval (10 sec in the code below). How could this be done, is there a variable that can be used for this or is there a way to calculate…
dmgeurts
  • 117
  • 8
1
vote
2 answers

Work with non-table values, aka "A is not subtractable"

I see many similar questions but couldn't find a good match. If we define a query and the result aught to be single value, is there a flux way to store as such? Example: total = from(bucket: "xxx") |> range(start: 0) |> filter(fn: (r) => ...) …
ThomDietrich
  • 79
  • 1
  • 7
1
vote
2 answers

InfluxDB v2.1 - Task executed but nothing wrote in destination bucket

I'm working with InfluxDB v2.1. I have this task: option task = { name: "DOWNSAMPLE APRILIA UTILITIES", cron: "0 * * * *", } from(bucket: "homeassistant-aprilia") |> range(start: -2h, stop: -1h) |> filter(fn: (r) => r["_measurement"] ==…
sineverba
  • 5,059
  • 7
  • 39
  • 84
1
vote
0 answers

InfluxDB Data Explorer: different results when re-running query?

Going through the Queries and Data Model section of Time to Awesome (therefore you can tell I'm just getting started with InfluxDB), I've noticed a seemingly strange behaviour: once the data (as provided in the tutorial) is ingested, running exactly…
ffi
  • 353
  • 4
  • 11
1
vote
1 answer

influx Error: flag provided but not defined

Trying to make my influx working and according to here, I should be able to do influx -execute but this is what I'm getting: $ influx -execute 'SHOW DATABASES' Incorrect Usage. flag provided but not defined: -execute NAME: influx - Influx…
xpt
  • 20,363
  • 37
  • 127
  • 216