Add Tag with multiple values in influxline/influxdb

1.2k Views Asked by At

Is it possible to send multiple values in a single tag in influxdb using the influxdb line protocol?

Something like this

application-metric, application=test-app,API=get,put cpu=15 1465839830100400200

Essentially measurement and timestamp are the same but different tags of the same key. InfluxDB: 1.8

1

There are 1 best solutions below

0
On

I don't exactly get what you want, so I just answering blind folded:

Influx 1.8 takes as line protocol one measurement and one (optional) timestamp. Then you can add as many tags and fields (=values) as you like.

Syntax is:

measurement(,tag_set) field_set (timestamp)

where as tag_set is tag_key=tag_value and field_set is field_key=field_value each of them comma-separated if >1 therefore it works without tags and 3 fields (=values):

myMeasurement temperature1=10,temperature2=20,status="all good" 1556813561098000000

with tags "sensor" and "location" and 3 fields:

myMeasurement,sensor=627,location=Narnia temperature1=10,temperature2=20,status="all good" 1556813561098000000

That's possible in one line. But you can not send two different tag-value-couples in one line. And you can't write two different points with same field_set but different tag_value for the same tag_key in the same line (afaik).

If you need several different "values" in one tag you could send it somehow separated by whatever and regex for it later:

myMeasurement,location=Narnia;South-West;Valley4 temperature1=10 1556813561098000000
SELECT * FROM myMeasurement WHERE location=~ /.*;South-West;.*/