Idea for CQs based workflow

Hi, I’m interested in setting up a a new influx based workflow and was hoping for some assistance due to becoming rather lost in the information that is already available.
Basically I have a dataset which among other things contains a value for a service uptime, 0 = OK and 1 = NOT OK. this value is taken at regular 5 minute intervals.
What I’d like to do is setup a CQ for said data, where any occurence of 1 is retained in a separate table in its entirety, while all occurences of 0 are downsampled (since they’re not really important)
Based on my research so far it seems as if the combination of RP and CQs are the rightway to go, however I haven’t been able to get my head around an actual implementation.
I’d very much appreciate it if anyone would be able to provide any answers or information to the below questions:

  1. It is possible to downsample data based on a conditional value? in this case the service status (0 or 1)
  2. I am aware that CQs will only apply to new data - therefore how would one approach the above problem in context of a dataset containing past time-series data?

Hello @andromeda306,
Welcome!
Your continuous query might look something like this:

CREATE CONTINUOUS QUERY "my_cq" ON "mydb" BEGIN SELECT "service uptime field"  AS "service uptime" HAVING "service uptime" = 1 INTO "my retention policy"."NOT OK measurement" FROM "service uptime measurement" GROUP BY time(<interval>) END

Please take a look at this example to understand how to create a new retention policy for your data that you want to keep around and the default for all of your data.

Thanks!

1 Like

Thanks very much for your response @Anaisdg. I’ll try it out and see whether it works!

1 Like

@andromeda306,
Great! Let us know how you get along :slight_smile:

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.