Grafana Loki pattern syntax error: unexpected IDENTIFIER

try to parse with pattern using Grafana + Loki

i am using

{pod=~“backend-deployment-.*”} |~ pattern <_> - - <_> "<method> <path> <_>" <status> <_> "<_>" "<_>" <_> <duration> [<service>] [<_>] <_> <_> <_> <_> <_>

to parse this log - - [27/Aug/2021:02:37:06 +0000] "GET / HTTP/2.0" 200 10842370 "" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" 34 20.031 [gymauto-gymauto-frontend-service-v1-8080] [] 10842370 20.035 200 a7c4299aaa7ea674e91d13315
**but there is error**
**parse error at line 1, col 35: syntax error: unexpected IDENTIFIER, expecting STRING**

not like backtick , what is best solution i try " " also ’ ’ but same error. can not use pattern

I have the same problem…
Grafana: v9.1.6
Loki: 2.1.0

This is in the new installation Grafana and Loki, but not old installation or upgraded Grafana.

Below my query:

{job="lb-vip"} | pattern `<ip> - - <_> "<method> <uri> <_>" <status> <size> <_> "<agent>" <_>` | __error__=``

I have this in the Latest Chrome and Firefox, respectively.

Is it about bug in latest Grafana (9.1.6) or something else?
Below the result in Explorer

Fadjar Tandabawana

I found it.
not a bug ,just a version question. you need match grafana and loki version.
just upgrade the loki version higher ,it’s fine.


I just change the log source to JSON format, and all the query works fine.
Just little bit change of the grafana queries to make it worked.

Fadjar Tandabawana

hello,buddy.which version does grafana version 9 was compatable to for loki.loki version 2.0.0 seems not work properly.

deeply,the difference between mine question to yours is that i wrote logql with autocomplete worked fine,however, when i wrote it myself what is same like grafana autocomplete but not using autocomlete,it seems like this error.and restful request seems url params ‘query’ was not same,