I’m a newbie in Grafana Loki plugin and I have one very interesting question.
Recently, I set up self-hosted grafana-server and Loki like systemctl services.
Writing own python library to send data from Django requests took time and I have the problem.
While sending dict object to Loki in my "stream" : {}
object, I get error, so I use either json.dumps(dict)
or f"{dict}"
formats of my json headers and json_body:
My working configuration is:
data = {
"streams": [
{
"stream": {
"host": self.host,
"levelname": record.levelname,
"headers": f"{record.message['headers']}",
"json_body": f"{record.message['json_body']}"
},
"values": [
[
str(self.format_timestamp(record.created)),
record.message["method"]
]
]
}
]
}
How can I send properly json format dicts to labels to make them real json on the first screen and properly prettify them like I do on the second screen?