[英]loki: "error at least one label pair is required per stream"
I am running loki, pomtrail, grafana locally in docker per these instructions我按照这些说明在 docker 本地运行 loki、pomtrail、grafana
When I try to run the following test to send data directly to loki:当我尝试运行以下测试以将数据直接发送到 loki 时:
curl -i -H "Content-type: application/json" -X POST --data '{ "streams": [ { "labels": { "job": "randomjob" }, "entries": [{ "ts": "2021-10-12T16:13:06.801064Z", "line": "TEST!" }] } ] }' http://localhost:3100/loki/api/v1/push
I get the error:我收到错误:
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Tue, 02 Nov 2021 12:09:26 GMT
Content-Length: 53
error at least one label pair is required per stream
Why isn't if finding the label?为什么不是如果找到标签? Thanks.
谢谢。
Format of the label pairs should be (for an old endpoint /api/prom/push
) and it works:标签对的格式应该是(对于旧端点
/api/prom/push
)并且它可以工作:
"labels": "{job=\"randomjob\"}"
Eg:例如:
curl -H "Content-Type: application/json" -XPOST -s "172.30.11.21:3100/api/prom/push" --data-raw '{"streams": [
{
"labels": "{job=\"randomjob\"}",
"entries": [
{
"ts": "2021-11-13T19:55:51.801064-00:00",
"line": "TEST!"
}
]
}
]
}' }'
For a new endpoint /loki/api/v1/push
it seems need to change labels
field to stream
:对于新的端点
/loki/api/v1/push
似乎需要将labels
字段更改为stream
:
curl -H "Content-Type: application/json" -XPOST -s "172.30.11.21:3100/loki/api/v1/push" --data-raw '{"streams": [{ "stream": {"job": "randomjob"}, "values": [["1636841990000000000", "TEST!" ]] }] }]}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.