Loki Log level - incorrect detect level and there is no present in grafana variable

Hi guys,

I have Loki v.3.0 and Grafana 10.2.6
I have incorrect label level for some logs. In the 90% cases - label level is correct.

promtail config:

static_configs:

  • targets:
    • localhost
      labels:
      host: xxx.xxx.xxx
      job: grafana
      path: /opt/local/grafana/var/log/grafana.log

loki, version 3.0.0 (branch: release-3.0.x, revision: b4f7181)
build user: root@0abc9c324f52
build date: 2024-04-08T18:33:19Z
go version: go1.21.9
platform: linux/amd64
tags: netgo

promtail, version 3.0.0 (branch: release-3.0.x, revision: b4f7181)
build user: root@0abc9c324f52
build date: 2024-04-08T18:33:19Z
go version: go1.21.9
platform: linux/amd64
tags: promtail_journal_enabled

Another issue - it’s no label level in the Grafana variables. I assume it 2 problem is related…


You need to insert level as label explicitly (so if you are using promtail, then promtail must insert level as label). That dashboard variable needs labels. Fields (please note different term is used, not labels) are parsed on Grafana level on the fly from selected logs.

1 Like

Thanks @jangaraj

So for each log file (I have a different format of logs ) promtail should create label using regex right ?