Hi,
A very basic question.
I’m using a SELECT query to get some traffic utilization for a device ‘abcd’ for Nov, 2017:
influx -execute “SELECT time, value FROM util_db WHERE hostname=‘abcd’ AND time >= ‘2017-11-01T00:00:00Z’ AND time <= ‘2017-11-30T00:00:00Z’ GROUP BY hostname” -database=mydb -precision=‘RFC3339’
I need to do some further processing on the output for which I need to know the ‘DAY’ (e.g Mon/Tue/Wed…) from the time-stamp. Is there a way to update the query to include the day of the week in the time-stamp?
You’ll have to specify the local timezone. The same timestamp can be different days of the week on different places on earth.
You could probably add a new tag for the day of the week with Kapacitor and an UDF. Then in Python, get the day of the week from the timestamp and send it back to Kapacitor. Then use Kapacitor to add the new tag.
If you want to do this in a client, what programming/scripting language are you going to use ? Each programming language has its specific datetime library.
If you want to do it all through queries, there was an issue about this but it’s still open:
To close this off, I ended up figuring out the day of the week by feeding the time-stamp into Python and getting it to return the day with calendar.weekday.