Search code examples
grafanagrafana-lokilogql

Binary operator in loki


Do binary operators for Loki queries exist? Is there a workaround to achieve something as this?

{job="myService"} 
  |~"AI Unable to update the session state in"
  OR 
  |~"Database Write Error"


Solution

  • No, you can't do that but you can do, for example, the following:

    {job="myService"} |~ "AI Unable to update the session state in|Database Write Error"
    

    Or the following:

    count_over_time({job="myService"} |~ "AI Unable to update the session state in" [1h])
    or
    count_over_time({job="myService"} |~ "Database Write Error" [1h])