# Influxdb group by time() not working

**URL:** <https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705>\
**Category:** Systems\
**Created:** [July 29, 2019, 3:46pm UTC](https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705 "2019-07-29T15:46:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mkrsanac](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mkrsanac/32/3377_2.png) [@Mkrsanac](https://community.influxdata.com/u/Mkrsanac)\
**Post date:** [July 29, 2019, 3:46pm UTC](https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705/1 "2019-07-29T15:46:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SuneethaSaka](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@SuneethaSaka](https://community.influxdata.com/u/SuneethaSaka)\
**Post date:** [July 30, 2019, 5:51am UTC](https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705/2 "2019-07-30T05:51:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mkrsanac](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mkrsanac/32/3377_2.png) [@Mkrsanac](https://community.influxdata.com/u/Mkrsanac)\
**Post date:** [July 30, 2019, 2:20pm UTC](https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705/3 "2019-07-30T14:20:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mkrsanac](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mkrsanac/32/3377_2.png) [@Mkrsanac](https://community.influxdata.com/u/Mkrsanac)\
**Post date:** [July 30, 2019, 4:54pm UTC](https://community.influxdata.com/t/influxdb-group-by-time-not-working/10705/4 "2019-07-30T16:54:00Z")

</div>

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

regards
