Expressions

The Obcerv entity expressions allow you to filter Obcerv data before performing operations or creating visualisations. It is a high level language for working with the Obcerv data model.

The expressions language is used in the following places:

This document provides an explanation of the syntax used for these expressions. In general, expressions take the form:

key operator value

where the key is an attribute or dimension name.

If you are using an attribute as your key, such as a classification attribute, then you can also specify a namespace:

namespace.key operator value

If a namespace is supplied, the expression will only match the attribute with the given namespace and name. However, if no namespace is supplied then the expression will match any attribute with the given name regardless of its namespace.

Obcerv uses a namespacing system so that dimensions and attributes can use the same structure in many contexts without interference. For more information, see Architecture

Variables Copied

Variables can be of the following types:

Variable Description Example
Array An ordered list. [item1, item2, item3]
Set An unordered list. (item1, item2, item3)
String A string literal. If the string contains spaces it must be contained in quotes. “my string”

Operators Copied

Comparisons Copied

Operator Token Example Notes
Equals = name = myserver1 If the first term does not exist then this evaluates as false.
Not equals != department != hr If the first term does not exist then this evaluates as true.
Greater than or equals >= disk_size >= 100000
Greater than > mem_size > 16000
Less than or equals <= mem_size <= 4000
Less than < disk_size < 10000

Array comparisons Copied

Operator Token Example Notes
Equals = hierarchy = [ ’namespace’, ‘pod’, ‘container’ ] If the first term does not exist then this evaluates as false.
Not equals != hierarchy != [ ’namespace’, ‘pod’, ‘container’ ] If the first term does not exist then this evaluates as true.
Starts with STARTS WITH hierarchy starts with ‘pod’
Contains all CONTAINS ALL hierarchy contains all [ ’namespace’, ‘pod’, ‘container’ ]

Set operators Copied

Operator Token Example
In IN department in (hr, finance, engineering)
Not in NOT IN department not in (hr, finance, engineering)

Exists operators Copied

Operator Token Example
Exists EXISTS department exists
Does not exist NOT EXISTS region not exists
Note: Dimensions or attributes containing the empty string are a special case, and are treated as if they do not exist by existence operators.

Boolean operators Copied

Operator Token Example Notes
And AND name != server1 and name != server2 or department in (hr, finance, engineering)
Or OR name != server1 and (name != server2 or department in (hr, finance, engineering)) AND normally takes precedence over OR, you can change this with parenthesis
["Obcerv"] ["Technical Reference"]

Was this topic helpful?