简体   繁体   中英

Formating loki log stream - err: loghttp.PushRequest.Streams

I am trying to stream logs from a SaaS platform into 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|..

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? Any idea why this error might occur?

Thanks

Maybe there's something wrong with your timestamp:1617704515000000000, if you use golang, you can try:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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