devops-kb
devops-kb copied to clipboard
Logs not getting ingested in Loki.
Hi, I was trying the following library to send logs to loki using python.
I am getting the 204 response as expected, but I am not seeing any logs in grafana when using that Loki instance as the data source.
Am I missing anything? I mean is there anything else that I have to do too apart from setting up lgrafana, loki, loki data source and running this script?
Thanks, and best regards, Sourav.
Hi! Please try again, today I approved pr with fix in path. Or provide more details "step by step" for reproduce this issue if its actual
The new endpoint uses a new format of payload, See https://grafana.com/docs/loki/latest/reference/loki-http-api/#ingest-logs
{
"streams": [
{
"stream": {
"label": "value"
},
"values": [
[ "<unix epoch in nanoseconds>", "<log line>" ],
[ "<unix epoch in nanoseconds>", "<log line>" ]
]
}
]
}
But the code still uses the old format. https://github.com/sleleko/devops-kb/blob/bddda7ef12185db94907f078384c26777a4b7df8/python/push-to-loki.py#L17-L29
The new endpoint uses a new format of payload, See https://grafana.com/docs/loki/latest/reference/loki-http-api/#ingest-logs
{ "streams": [ { "stream": { "label": "value" }, "values": [ [ "<unix epoch in nanoseconds>", "<log line>" ], [ "<unix epoch in nanoseconds>", "<log line>" ] ] } ] }
But the code still uses the old format.
https://github.com/sleleko/devops-kb/blob/bddda7ef12185db94907f078384c26777a4b7df8/python/push-to-loki.py#L17-L29
Hi! Thank you! I will update my example soon.