Can i filter buckets() to show only buckets with part name or containing a certain value on a measurement

  • What Grafana version and what operating system are you using?
    Grafana * v8.5.2 (90701be19)
    Indlux DB v2.2.0
    Linux: Ubuntu 20.04.4 LTS

  • What are you trying to achieve?
    I have a variable to choose source of my data, i use Buckets() but i want to filter this to buckets that either matches a string with wildcard (*) or have a certain value in one of the measurements.

The amount of buckets availible is dynamic since i keep adding buckets with a script so the query must be dynamic to include all buckets in the search for matching ones.

  • How are you trying to achieve it?
    I have tried all i can think of but it’s really hard to find guides and sources on flux to achieve what i’m trying to do.

  • What happened?
    I get either all or exact match on bucket if i set a name instead of Buckets()

  • What did you expect to happen?
    I want to select only buckets whos name starts with the string provided OR
    I want to select only buckets that contains a certain value in a specified measurement
    Either one of the above or both is ok.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No it’s a Flux either restriction or ignorance from my side and i can’t seem to find guidance to learn what i need

  • Did you follow any online instructions? If so, what is the URL?
    I’ve scoured google for this matter but i can’t seem to find what i’m looking for

It is fine to create a new bucket with all the bucket names as a measurement and then select from the names with a wildcard from that bucket if this is possible

Welcome @timmyol

If you have not already done so, your question should probably be posted to the InfluxDB forum as there will be many more there who should be able to answer your question.

My understanding is that the Organization is the top-most level for InfluxDB organization, and Bucket is the next highest. As you probably already know,

A bucket is a named location where time series data is stored. All buckets have a retention period , a duration of time that each data point persists. InfluxDB drops all points with timestamps older than the bucket’s retention period. A bucket belongs to an organization.

If I had to guess, I would think you would write two queries, something like this:

from(bucket: "first_bucket")
|> your Flux query here

from(bucket: "second_bucket")
|> the same Flux query here

yes i’ll post there too, thanks,

I forgot to mention this in the question but it’s a dynamic amount of buckets which is added by a script so manually adding queries for each one is not possible

maybe add some regex in there.