Reputation: 463
I am new to Influx DB
I have to insert the following data to my local influx DB using curl command
test_aggregate,processor=name,env=test_env,workspace=test_job_name,area=test_area,test-suite=test_name,build-id=test_build_no,test-name=test_uc_no,step-index=1,step-execution-time=1,step-error-message=No message,test-result=1 1572915987025
I am using following curl command
curl -i -X POST "http://localhost:8086/write?db=test_db_local&precision=s" --header "Authorization: Token maha:jhdasdaak" --data-binary 'test_aggregate,processor=name,env=test_env,workspace=test_job_name,area=test_area,test-suite=test_name,build-id=test_build_no,test-name=test_uc_no,step-index=1,step-execution-time=1,step-error-message=No message,test-result=1 1572915987025'
But when I execute the above curl command, I get the following error
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: f9084cf7-ecf0-11ea-811c-000d3ab37764
X-Influxdb-Build: OSS
X-Influxdb-Error: unable to parse 'test_aggregate,processor=name,env=test_env,workspace=test_job_name,area=test_area,test-suite=test_name,build-id=test_build_no,test-name=test_uc_no,step-index=1,step-execution-time=1,step-error-message=No message,test-result=1 1572915987025': invalid field format
X-Influxdb-Version: 1.8.2
X-Request-Id: f9084cf7-ecf0-11ea-811c-000d3ab37764
Date: Wed, 02 Sep 2020 07:50:30 GMT
Content-Length: 315
Where am I going wrong in syntax?
Thanks in advance!
Upvotes: 0
Views: 5916
Reputation: 466
Yes the data format is wrong,
The data should be in line format, measurement1,tag1=value1,tag2=value2 field1=value1, field2=value2 timestamp
Explanation: measurement_name followed by comma and list of tags (comma separated), then a space followed by fields (comma separated) and again a space followed by timestamp with the right precision
Note: Space acts as a separator between tags, fields, and timestamp
In your case there are couple of mistakes,
Correct curl command will look like
curl -i -X POST "http://localhost:8086/write?db=test_db_local&precision=s" --header "Authorization: Token maha:jhda sdaak" --data-binary 'test_aggregate,processor=name,env=test_env,workspace=test_job_name,area=test_area,test-suite=test_name,build-id=test_build_no,test-name=test_uc_no,step-index=1,step-execution-time=1,step-error-message=No\ message,test-result=1 field1=0 1572915987'
I have given a dummy field called field1 with 0 value for example, you can move some tags to fields if needed
Upvotes: 2