-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
/api/prom/push produce error 400 with 'unexpected IDENTIFIER' #1727
Comments
The error should be better, the label field is incorrect. See https://github.com/grafana/loki/blob/master/docs/api.md#examples-8 Also I recommend you to use the v1 API see the link above. |
I can take a look at this! |
Sure I'll feed you with more info on how to on Monday! |
Hi, {"streams": [{ "labels": "{foo="bar"}", "entries": [{ "ts": "2018-12-18T08:28:06.801064-04:00", "line": "fizzbuzz" }] }]} The error is : |
I’m sorry you’re encountering this again, the v1 api has a different label format. See https://github.com/grafana/loki/blob/master/docs/api.md#examples-4 Basically now it’s a map before it was a string. |
@talham7391 It's happening here: https://github.com/grafana/loki/blob/master/pkg/distributor/validator.go#L60 I would change add more context to the error. Something like
|
Okay great, will push a PR soon! |
Describe the bug
When trying to submit stream thru api endpoint "/api/prom/push" loki return error code 400 with not helpful message "parse error at line 1, col 1: syntax error: unexpected IDENTIFIER"
To Reproduce
1 clone grafana/loki from https://github.com/grafana/loki
2 Run docker-compose up
3 Using chrome plugin ARC create POST request with based on documentation from https://github.com/grafana/loki/blob/v1.3.0/docs/api.md#get-lokiapiv1labels:
CURL output:
c:\test\loki\production\loki-mixin>curl -H "Content-Type: application/json" -X POST "http://localhost:3100/api/prom/push" -d "{"streams": [{ "labels": "cats", "entries": [{ "ts": "2018-12-18T08:28:06.801064-04:00", "line": "fizzbuzz" }] }]}"
parse error at line 1, col 1: syntax error: unexpected IDENTIFIER
4 Loki server return "parse error at line 1, col 1: syntax error: unexpected IDENTIFIER"
Expected behavior
HTTP status code 2XX or better explanation what is missing/incorrect
Environment:
The text was updated successfully, but these errors were encountered: