Hello,
I am using Influx & Kapacitor to process data coming from various applications. Each application sends an event (a ‘subscription’) as soon as a business user performs an action with this application. Each hour for a given month, I need to generate a measurement (subscriber, value is total number of subscribers") containing the total number of subscriptions received so far.
I was planning to:
- use a batch node
- perform a query for counting all subscriptions for a current day
- store this count to a new measurement (total_subscriptions)
It should look something like this:
batch
| query(‘select “dummy_value” from “mydb”.“autogen”.subscription where day(time) == day(now())’
.count()
.as('total_count)
| log()
| influxDBOut()
.database(“mydb”)
.measurement(“subscriber”)
.tag(“computed”,‘true’)
My question is how can I write my query as I haven’t found any way of extracting the day from the ‘now()’ function as well as getting the current day/month/year?
Thank you very much for your help!
Thanks for your help!