Influxdb group by time() not working

Hi All!!! I’m having issues with group by time function, when I add this function to the query no data is bring, example from influx:

SELECT * FROM “heartbeats” WHERE time >= now() - 30s
name: heartbeats
time app az dpcolor health host metric_db pod region release service up weight


2019-07-29T13:19:30Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:19:30Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:19:30Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:19:40Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:19:40Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:19:40Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:19:50Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:19:50Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:19:50Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:20:00Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:20:00Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:20:00Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:20:10Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:20:10Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:20:10Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:20:20Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1
2019-07-29T13:20:20Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:20:21Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:20:30Z edge $APIGEE_AZ green 1 xxx application central dc-1 180608_08 management-server 1 1
2019-07-29T13:20:30Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 message-processor 1 1
2019-07-29T13:20:30Z edge $APIGEE_AZ green 1 xxx application gateway dc-1 180608_08 router 1 1


query with group by time:

SELECT count(“up”) FROM “heartbeats” WHERE time >= now() - 30s group by time(10s)

no data returned, any help will be appreciate it.

regards,

Matías

Hi @Mkrsanac,
Try to play with interval, flush_interval times in the telegraf configuration file. I has similar issue, when I changed precision of nano seconds, it worked. For me now() -1s, was not giving data. After I move to nano precision , now() - 1s, give data.
Please try and let me know.

Hi @SunnethaSaka, thanks for the reply, looks like the issue is related with container time configuration, I’m not sure why the container is displaying wrong hour for UTC timezone, is 4 hour back(GMT-4), any idea?

bash-4.4# date
Tue Jul 30 10:19:23 UTC 2019

and showld be 14:19

regards

Hi @SuneethaSaka, issue resolved, problem was missconfigured time on host, once fixed query works as expected,

regards

1 Like