How can I query all the buckets in an organization using Flux?

theirman
Fri, 29 Mar 2024 12:50:38 +0000
InfluxDB 2

Hello everyone

I have a use case that requires me to query all the buckets in an organization, not a specific bucket.

when querying a specific bucket, I use the syntax :

from(bucket: "bourges")
|> range(start: 2024-03-27T10:00:00Z, stop: 2024-03-27T11:00:00Z)

when querying an org, I use the syntax :

from(org: "test")
|> range(start: 2024-03-27T10:00:00Z, stop: 2024-03-27T11:00:00Z)

I get the error message :

{"code": "invalid", "message": "error calling function \"from\" @1:1-1:18: must specify bucket or bucketID"}

when querying a list of buckets, I use the syntax :

from(bucket: "bourges", "tours", "orleans")
|> range(start: 2024-03-27T10:00:00Z, stop: 2024-03-27T11:00:00Z)

I get the error message :

{"code": "invalid", "message": "compilation failed: error @1:6-1:43: string literal key tours must have a value\nnerror @1:6-1:43: string literal key orleans must have a value\nnerror @1:6-1:43: cannot mix implicit and explicit properties"}

when querying a list of buckets with several bucket tag, I use the syntax :

from(bucket: "bourges", bucket: "tours", bucket: "orleans")
|> range(start: 2024-03-27T10:00:00Z, stop: 2024-03-27T11:00:00Z)

I get the error message :

{"code":"invalid","message":"duplicate keyword parameter specified: \"bucket\""}

How do you go about multi-bucket queries?

Thanks for your help

Thierry

3 posts - 2 participants