I have this raw data:
select * FROM "message_sent" WHERE time > now() - 1m
name: message_sent
time appCodename host sent
---- ----------- ---- ----
1531851267026022790 demo example.com 1
1531851271255490598 demo example.com 1
1531851271263690187 demo2 example.com 1
I’m using a Continuous Query to downsample some information like total messages sent in an hour using this CQ:
CREATE CONTINUOUS QUERY "cq_messages_sent_hourly" ON "stats"
RESAMPLE EVERY 10m FOR 120m
BEGIN
SELECT count("sent") AS "messages_sent"
INTO "stats"."autogen"."cq_messages_sent_hourly"
FROM "stats"."autogen"."message_sent"
GROUP BY time(1h), "appCodename", "host" FILL(none)
END
This works fine, I get a new measurement with:
select * FROM "cq_messages_sent_hourly" WHERE time > now() - 1h
name: cq_messages_sent_hourly
time appCodename host messages_sent
---- ----------- ---- -------------
1531850400000000000 demo example.com 215
1531850400000000000 demo2 example.com 37
But if I execute the query directly, outside the CQ (to process older values that haven’t been analyzed by the CQ) it doesn’t stores the host
tag to the cq_messages_sent_hourly
measurement, only the appCodename
and aggregated data messages_sent
.
Example result:
select * from "cq_messages_sent_hourly" WHERE time > now() - 6d
name: cq_messages_sent_hourly
time appCodename messages_sent
---- ----------- -------------
1531335600000000000 demo 291
1531335600000000000 demo2 5
The query I’m using is:
SELECT COUNT("sent") AS "messages_sent"
INTO "cq_messages_sent_hourly"
FROM "message_sent"
WHERE time < '2018-07-14T09:00:00.000Z'
GROUP BY time(1h), "host", "appCodename"
I’m using InfluxDB version 1.5.2.
Do you know what could be wrong?