40

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?

Asier Gomez
  • 6,034
  • 18
  • 52
  • 105

1 Answers1

79

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.

brian-brazil
  • 31,678
  • 6
  • 93
  • 86
  • 1
    Okey really thanks!! it works for me, I don't think it is a smell, its only for the templating variable (not for grafana graphics) – Asier Gomez Mar 31 '17 at 08:01
  • 2
    why would an or operation be a smell? seems like something that would be very practical – mike01010 May 14 '23 at 07:29