Variable based on field value (json)


I’m using Loki and Promtail with Nginx web servers (json format).

We can create variable based on log labels, it just works

Now, I would like to create a new variable based on the server_name field

With the json parser fields become labels, that’s why I guess it’s possible to create a such variable.

is there anyway to do that ?

Thanks for your help

So just to confirm, server_name is a label extracted from log content using parser (json | logfmt | regex), right? If so, no, there is currently no way how to create template variable based on label extracted from log content using parser.

Right, i’m using the json parser ({job="nginx-json",filename="/var/log/nginx/access_json.log"} | json)

Thanks for the reply

Does support for using label extracted from log message for dashboard variable is in the pipeline? or is it something that won’t be supported?