The log stream selector limits which records a query will be evaluated on. As stream selectors match on the indexed key-value labels, this filtering is very cheap and fast to do.

The log stream selector is written by wrapping the key-value pairs in a pair of curly braces:

{app="mysql",name="mysql-backup"}
{host="td1-plg-vmweb01",log_type="nginx_access_log"}
{host=~"^td1-plg-vmweb.*",log_type="nginx_access_log"}

The following comparison operators are supported:

  • =: exactly equal.
  • !=: not equal.
  • =~: regex matches.
  • !~: regex does not match.

Regexes use Go RE2 syntax. The matching is case-sensitive by default and can be switched to case-insensitive prefixing the regex with (?i).