We use cookies to ensure that we give you the best experience on our website.  Visit our Privacy Policy to learn more. If you continue to use this site, we will assume that you are okay with it.

Your choices regarding cookies on this site.
Your preferences have been updated.
In order for the changes to take effect completely please clear your browser cookies and cache. Then reload the page.

Werk #6972: Support SQL-style quoting for filtering dict-valued columns

TitleSupport SQL-style quoting for filtering dict-valued columns
Date2019-06-07 11:09:21
Checkmk EditionCheckmk Raw Edition (CRE)
Checkmk Version1.6.0b2,1.7.0i1
LevelTrivial Change
ClassNew Feature
CompatibilityCompatible - no manual interaction needed

Some Livestatus columns do not contain a simple value or a list of such values, they contain a dictionary of key/value pairs. More concretely, the

  • custom_variables
  • label_sources
  • labels
  • tags

columns in the

  • contacts
  • hosts
  • hostsbygroup
  • services
  • servicesbygroup
  • servicesbyhostgroup

tables contain dictionary values. Livestatus filter for such columns have a special syntax:


As an example, the query:

GET hosts
Filter: tag = agent cmk-agent

returns all hosts where the tag "agent" has the value "cmk-agent". Note that the key and the value are separated by whitespace. But this makes it impossible to query for a tag name with spaces. To support more general keys and values in such filters, Livestatus now additionally supports SQL-style quoting for such column filters:

Filter: labels = 'It''s so' 'cool, man!'

This filter matches a label with key "It's so" and value "cool, man!". Note the use of 2 consecutive single quotes to represent 1 single quote. The previous syntax still works, the new syntax is triggered by a leading single quote in the key and/or value.