1 minute influx query fetching last 6 hours data



I use influxDB.

when i run the below query i am supposed to get 6 values(Since telegraf agent colllects data once every 10seconds 1 minute = 6 data points) but i am getting 2399 values

select http_response_code from http_response where host = ‘server’ and time > now() - 1m

the query is fetching data for the past 6 hours, can anyone help me why this is happening and how can i fix this issue.

desired output: now() - 1m should display only 6 data-points
current output: now() - 1m displays last 6 hurs and 1 minute of data

While when i give time it is showing me my desired output. query below
time > ‘2018-06-07T11:15:00Z’ and time < ‘2018-06-07T11:16:00Z’;


Can you share more details about your configuration? When I do a similar query on my data, I only get the previous minute of data.


What time zone are you in? What timezone are the timestamps you store?


I am in central time zone, UTC +6
time stamps are stored in influx time utc time zone


time > ‘2018-06-07T11:15:00Z’ and time < ‘2018-06-07T11:16:00Z’;
this shows accurate time

time > now() - 1m
this query shows 6 hours and 1 minute data.
earlier i used to get last minutes information for this query. I am not sure what happened can you please help me fix this issue.


I saw some where that a kapacitor script can handle this. can you please guide me through that. Or is there something that i can do in influxdb


I don’t think you need Kapacitor or a TICKSCRIPT to do this. If the query used to work, that might mean that something changed about your data or the way that you’re collecting it.

Even if Telegraf is only collecting every ten seconds, that doesn’t mean it’s only grabbing one data point for that ten seconds. Can you verify that that is the case?


I guess you just found where your 6 extra hours came from.


yes telegraf is collecting data once every 10 seconds and it collects only one data point for each 10 seconds.

But the problem is i am getting the data of the last 6 hours and 1 minute when i run the

now() - 1m query


@hbs but the problem is the query used to work fine till last week, Why am i getting this error now.
can you suggest me a solution to fix this.


If the query worked before, that probably means that something changed with your data. I would check on your retention policies and the shards you’re querying.