Regex in Job Names

I’ve got a setup where promtail is feeding logs from several machines. The job name in the promtail configuration file on each machine is “machine-name_varlog”, for instance,

nextcloud_varlog
desktop_varlog
grafana_varlog

If I want a list of log-lines containing the word “error” or “Error”, I figured I could do something like this in a query in Grafana:

{job=~"varlogs"} |~ "[Ee]rror"

That doesn’t work, however. I only get matches on the exact name of the job. Is it possible to use regex in job names? If not, how do I go about achieving the result I am looking for? Thanks.

Hello @hubba, this should work for you {job=~".*varlog"} |~ "[Ee]rror".

1 Like

That worked! Thanks!

1 Like