Influx - INSERT value not working

Hello

How can I insert a value into my Influx 1.12 DB? I have 1.x-c9a9af2d63 (I think that’s 1.12) on a Raspberry Pi 3 B+ and I am collecting values from my gasmeter into the db “gaszaehler” with field “zaehlerstand”:

> use gaszaehler 
Using database gaszaehler
> select * from zaehlerstand order by time desc limit 1
name: zaehlerstand
time                kubikmeter
----                ----------
1772604767445944143 67674.66

So now I tried to insert own data into this db (as in the doc example) with:

> insert zaehlerstand, kubikmeter=67674.661
ERR: {"error":"unable to parse 'zaehlerstand, kubikmeter=67674.661': missing tag key"}

But neither this works:

> insert zaehlerstand, kubikmeter=67674.661,time=1772604767445944144
ERR: {"error":"unable to parse 'zaehlerstand, kubikmeter=67674.661,time=1772604767445944144': missing tag key"}

How is it done?

Thanks, frank

@francwalter Remove the comma after zaehlerstand. If you don’t include any tags, you don’t need the comma after the measurement name.

insert zaehlerstand kubikmeter=67674.661

Thanks, that works, but how can I add the time to the INSERT?
Without timetag the data (kubikmeter) is added as now, but I need older time values.

In Line Protocol, the time value is specified using an integer after the field set (separated by a space):

So in your case, it would be:

insert zaehlerstand kubikmeter=67674.661 1772604767445944144

This is covered in detail in the InfluxDB Line Protocol documentation (this links to the v2 line protocol docs which I think is clearer than the v1 LP docs, but the syntax is the same).

1 Like