Syntax error in insert

Dear All,

Please let me know what is wrong in below insert line protocol syntax.

INSERT oldata,app=“smart-irrigation-crc”,device=“00E2E78CE5A58029”,node=5,probe1=123081,probe2=21462,probe3=122,probe4=61,site=“fogarty” 2019-10-01T12:42:39.024Z

Thanks & Regards
Varun

@Varun with that line of line protocol, you aren’t passing any fields. Everything is being passed as a tag. InfluxDB requires at least one field per line of line protocol. Use a space to delimit your tag set from your field set. Also, you don’t need the double quotes in your tag values. You also need to format the timestamp as an epoch timestamp. Line protocol doesn’t support RFC3339 timestamps.

There’s more information here: Line protocol | InfluxDB OSS 2.0 Documentation

I had to do a little guessing here, but I assume each probe# should be a field and everything else should be a tag. The following line protocol should work for you.

oldata,app=smart-irrigation-crc,device=00E2E78CE5A58029,site=fogarty,node=5 probe1=123081,probe2=21462,probe3=122,probe4=61 1569933759024000000

Dear Scott/All,

Thanks for your response. Now I am could able to insert the records into influxdb. But when I insert date as 1569935368 (that is 2019-10-01 13:09:28). On select it is returning date as “1970-01-01T00:00:01.569935368Z” .

Is there any setting we need to do or am I missing something.

Steps:
delete from oldata
precision rfc3339
INSERT oldata,app=smart-irrigation-crc,device=0053A69FD3B8EEAC,site=eastern,node=2 probe1=294123,probe2=149955,probe3=159024,probe4=240825 1569935368
select * from oldata

Thanks & Regards
Varun

Try to add the zeroes (as in scott example) in order to have the time in nanoseconds
so 1569935368000000000 instead of 1569935368

@varun.kadur As @Giovanni_Luisotto said, the default precision expected by InfluxDB is nanoseconds. If writing data with the INSERT statement, timestamps must be nanosecond epoch timestamps. You are able to specify the precision of your timestamps if you’re writing data using the InfluxDB API, but you can’t specify precision with the INSERT statement.

1 Like

Thanks for the response issue got resolved

Thanks & Regards
Varun