Hi,
I’ve just implemented Grafana, Loki and PromTail to extract logs from my OpenHab home automation setup.
For this particular log If I have an entry of:
2022-04-13 12:00:27.274 [INFO ] [.openhab.core.model.script.speedtest] - --> speedtest output:
{"type":"result","timestamp":"2022-04-13T11:00:27Z","ping":{"jitter":3.5489999999999999,"latency":8.7349999999999994},"download":{"bandwidth":25240775,"bytes":371787244,"elapsed":15010},"upload":{"bandwidth":2622651,"bytes":20608200,"elapsed":7904},"packetLoss":0,"isp":"Virgin Media","interface":{"internalIp":"192.168.0.12","name":"eth0","macAddr":"AA:BB:CC:DD:EE:FF","isVpn":false,"externalIp":"86.4.170.46"},"server":{"id":3504,"host":"speedtest.tnp.net.uk","port":8080,"name":"TNP Ltd.","location":"Manchester","country":"United Kingdom","ip":"11.22.333.444"},"result":{"id":"c29cb8fe-6444-45c7-a564-82e9020c7f9a","url":"https://www.speedtest.net/result/c/c29cb8fe-6444-45a1-a123-aaaaaaaa","persisted":true}}
Using this regex expression:
^(?P<time>.+) \[(?P<level>[a-zA-Z]+) ?\] \[(?P<component>[a-zA-Z \.]+)\] - (?P<output>.+)$
On regex101: build, test, and debug regex I can see the expression is correctly split:
However, in Grafana I see:
Thanks,
Richie