0

我正在尝试将日志从 SaaS 平台流式传输到 loki。我收到以下错误 loghttp.PushRequest.Streams: []*loghttp.Stream: loghttp.Stream.Labels: ReadString: expects " or n, but found {, error found in #10 byte of ...|","log": {"id":[469|..., bigger context ...|":[{ "stream": {"env": "XXXXX_logs","log": {"id":[4692850486,1470085],"flow_id":1470085,"pare|..

curl -v -i -u USER -H "X-Scope-OrgID: test-loki" -H "Content-Type: application/json" -XPOST -s "http://localhost:8088/loki/api/v1/push" --data-raw '{"streams":[{ "stream": {"env": "dev_logs","log": <ANOTHER HUGE JSON OBJECT HERE>}, "values": [ [ "1617704515000000000", "fizzbuzz"] ]}}]}'

我的问题是:loki 是否支持像这样在流中嵌套 Json?知道为什么会发生此错误吗?

谢谢

4

1 回答 1

-1

可能你的时间戳有问题:1617704515000000000,如果你用golang,可以试试:

fmt.Sprint(time.Now().UnixNano())
于 2021-12-15T06:54:25.427 回答