简体   繁体   English

形成 loki 日志 stream - 错误:loghttp.PushRequest.Streams

[英]Formating loki log stream - err: loghttp.PushRequest.Streams

I am trying to stream logs from a SaaS platform into loki.我正在尝试将来自 SaaS 平台的 stream 日志记录到 loki 中。 I get the below error 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|..我收到以下错误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"] ]}}]}'

My question is: does loki support nesting of Json inside streams like this?我的问题是:loki 是否支持在这样的流中嵌套 Json? Any idea why this error might occur?知道为什么会发生此错误吗?

Thanks谢谢

Maybe there's something wrong with your timestamp:1617704515000000000, if you use golang, you can try:可能你的时间戳有问题:1617704515000000000,如果你用golang,可以试试:

fmt.Sprint(time.Now().UnixNano())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM