Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

line protocol : bad timestamp when inserting multiple data points #2984

Closed
lakshmanav opened this issue Jun 15, 2015 · 8 comments
Closed

line protocol : bad timestamp when inserting multiple data points #2984

lakshmanav opened this issue Jun 15, 2015 · 8 comments

Comments

@lakshmanav
Copy link

Hello Team, When writing multiple data points to the HTTP write api as mentioned below, I get a 400 (bad time stamp). However when I choose to write a single data point I get 204. Any idea why ?

cpu_1,host=serverA,region=us-west value=1.0 10000000000
cpu_2,host=serverB,region=us-west value=3.3 10000000000

@lakshmanav lakshmanav changed the title line protocol : Problem inserting multiple data points line protocol : bad timestamp when inserting multiple data points Jun 15, 2015
@frehm
Copy link

frehm commented Jun 15, 2015

I had the same issue when posting multiple lines from a C# HttpClient using a StringBuilder with AppendLine and the default encoding for StringContent. Switching to using Append with \n as new line and specifying Encoding.ASCII for the StringContent seems to have solved the problem for me.

@otoolep
Copy link
Contributor

otoolep commented Jun 15, 2015

@lakshmanav - can you please demonstrate this issue using curl commands? Show us that? That would be best.

@jananithiru
Copy link

Hey Guys,

I face the same issue. I even tried the curl command from the terminal.

I copied this from the documentation and ensured it had new lines characters between each point but I get a bad timestamp error.

curl -i -XPOST 'http://localhost:8086/write?db=mydb' -d ' 
cpu_load_short,host=server01,region=us-west value=0.64 
cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257 cpu_load_short,direction=in,host=server01,region=us-west value=23422.0 1422568543702900257'

HTTP/1.1 400 Bad Request
Request-Id: da13e867-1474-11e5-8067-000000000000
X-Influxdb-Version: FIXME
Date: Tue, 16 Jun 2015 22:13:01 GMT
Content-Length: 13
Content-Type: text/plain; charset=utf-8

bad timestamp%

Similarly, Even if I remove the timestamps associated with each point, I get the same response

curl -i -XPOST 'http://localhost:8086/write?db=mydb' -d ' 
cpu_load_short,host=server01,region=us-west value=0.64 
cpu_load_short,host=server02,region=us-west value=0.55 cpu_load_short,direction=in,host=server01,region=us-west value=23422.0'


HTTP/1.1 400 Bad Request
Request-Id: da13e867-1474-11e5-8067-000000000000
X-Influxdb-Version: FIXME
Date: Tue, 16 Jun 2015 22:13:01 GMT
Content-Length: 13
Content-Type: text/plain; charset=utf-8

bad timestamp%

@beckettsean
Copy link
Contributor

@juzzjan191 in both of your examples your third point is on the same line as your second, in the position where a timestamp would be expected. It looks like they are on different lines but that's just line wrap. The character in between is not a full \n, but instead a simple space.

Can you verify that your tests are running exactly this:

curl -i -XPOST 'http://localhost:8086/write?db=mydb' -d ' 
cpu_load_short,host=server01,region=us-west value=0.64 
cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257
cpu_load_short,direction=in,host=server01,region=us-west value=23422.0 1422568543702900257'

@lakshmanav
Copy link
Author

I was using \r\n( a windows line ending) to delimit data points. Using \n solved the issue. Thanks @frehm @otoolep and @beckettsean for jumping in.

@jananithiru
Copy link

@beckettsean , Using a space and \n works between points.

curl -i -XPOST 'http://localhost:8086/write?db=mydb' -d 'cpu_load_short,host=server01,region=us-west value=0.64
cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257
cpu_load_short,direction=in,host=server01,region=us-west value=23422.0 1422568543702900257'

Thanks for your help

@singakash93
Copy link

Hello Team

I am trying to ingest multiple rows of data to the HTTP using curl as mentioned in the Influxdb documentation, I get a 400(bad time stamp) and parse error. Even after using \n or \r\n (trail and error method) it doesn't work. whereas I am able to ingest single row of data. Any ideas would be highly appreciable.

category_1,host=serverA,region=us-west value=15.6669 10000000000
category_2,host=serverB,region=us-east value=13.6678 10000000000

@penguinpowernz
Copy link

penguinpowernz commented Jun 10, 2018

Another cause for this can be when you are loading from a file using curl. You must use the curl option --data-binary @filename.ilp or else it trims the newline characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants