How do I write an "or" logical operator on Prometheus or Grafana

Asier Gomez picture Asier Gomez · Mar 31, 2017 · Viewed 15.6k times · Source

I need to write a query that use any of the different jobs I define.

{job="traefik" OR job="cadvisor" OR job="prometheus"}

Is it possible to write logical binary operators?

Answer

brian-brazil picture brian-brazil · Mar 31, 2017

Prometheus has an or logical binary operator, but what you're asking about here is vector selectors.

You can use a regex for this {job=~"traefik|cadvisor|prometheus"}, however that you want to do this is a smell.