I need to post on Loki using only CURL but I'm getting bad request

I’m using the following curl command:
curl -v -H “Content-Type: application/json” -XPOST -s
http://localhost:example/loki/api/v1/push” --data-raw ‘{“streams”:[{“stream”: {“job”: “varlogs”},“values”: [[1568234281726420425",“foo”],[“1568234269716526880”,“bar”]]}]}’

{“code”:400,“status”:“error”,“message”:“readObjectStart: expect { or n, but found ‘, error found in #1 byte of …|’{streams:[|…, bigger context …|’{streams:[{stream:{job:varlogs},values:[[156823428|…”}

How to solve this error?


Hi @giovannisinosini ,

at least from what you pasted, the JSON is not valid. You are at least missing a " before the first int in values.

Try with this


Unfortunately, that’s not it.

I tried the example from here

This is my result. I have Loki behind a reverse proxy with basic auth.

Enter host password for user 'my-user':
entry for stream '{foo="bar2"}' has timestamp too old: 2019-10-11 18:23:58 +0000 UTC

I would make sure you are pointing at your distributor service if you run microservices mode.

From HTTP API | Grafana Labs

    POST /loki/api/v1/push