Count the number of times a tag appears in influxdb

I have an influxdb database called 'cars' that counts the cars that pass by my building. One tag for this is called 'make', where make = {ford, toyota...}. I'd like to count the number of times each car has passed by my building, by counting the number of entries with each tag.

Is this possible in InfluxDB?

Edit:

This does not work:

> select count(make) from my_series where time > now()-10d group by make;
name: my_series
tags: make=
time                count
----                -----
1524058438416676920 764724

Upvotes: 2

Views: 6342

Answers (1)

Yuri Lachin
Yuri Lachin

Reputation: 1500

Query like this will give you number of entries per make for the last hour:

SELECT COUNT(somefield) FROM cars WHERE time > now() - 1h GROUP BY make

Upvotes: 5

Related Questions