I have an influxQL query:

SELECT sum(“metrics written”) FROM (

SELECT max(“metrics_written”) - min(“metrics_written”) as “metrics written”

FROM “tsesre_gms”.“anonymous”.“internal_write”

WHERE time > now() - 5m AND “alias” =~ /^output_.*_cp_v1$/

GROUP BY “alias”, “cp_node”

)

When i ran this query, the timestamp which i am getting with the result is "01/01/1970 05:30:00

". I know this is because influx is using epoch 0 because of the use of aggregate functions. But i am not sure how to get current timestamp with this.

I tried adding “time()” with the GROUP BY clause, but still i am getting the same result.

SELECT sum(“metrics written”) FROM (

SELECT max(“metrics_written”) - min(“metrics_written”) as “metrics written”

FROM “tsesre_gms”.“anonymous”.“internal_write”

WHERE time > now() - 5m AND “alias” =~ /^output_.*_cp_v1$/

GROUP BY “alias”, “cp_node”, “time(5m)”

)

Would appreciate if someone can help me with this.

Thanks.