Batch Query using relative defined time ranges

Please point me to another discussion if this has already been answered. I’ve been scouring the internet for days looking for an answer.

I have yesterday’s data that gets placed into influx nightly.

I’m trying to setup a batch kapacitor task that will query “yesterday’s” data from 00:00:00 to 23:59:59.

I’m running this as a batch in the early hours of the morning. I can give the job a period of 24 hours offset by the 5 hours from the cron running at 5am.

What I would really prefer is to grab data from yesterdays_dateT00:00:00Z to yesterdays_dateT23:59:59Z. Is there any way I can use the now() function in kapacitor to figure out yesterdays (or any other date) from what is returned?

In Grafana I can use timestamps of From: now-2d/d to: now-1d/d. It looks like Grafana is doing the legwork of converting that to a ms timestamp and then using that for the query.

Any help is greatly appreciated.

Hello @modem158,
Welcome! I don’t know how to achieve this with kapacitor but I do know how you could achieve this with Flux. Any chance you can upgrade to 2.x?

@Anaisdg Thanks for your reply. I’ll have to see what I have available and what the implications of switching to 2.x are for me. I’ll get back to you if I can manage the upgrade.

1 Like

@modem158 if you decide you can, lets work on that task together!