Syntax for advanced filter in Management Console
Please note, we have new filter expressions which should be used as soon as you are able. These can be found here.
Advanced filter syntax consists of numbers, identifiers and function calls, joined with comparison operators. The list of supported operands is below.
Operand | Description |
---|---|
true , false |
Boolean |
"foo" , 'bar' |
String |
123 , 234 |
Integer number |
123.456 , 0.5 |
Floating-point (real) number |
foo , bar.baz |
Identifier |
foo() , bar.foo() |
Function call |
Identifiers and function calls are evaluated to booleans, strings and numbers during expression evaluation, thus they could appear anywhere those simple types are allowed.
Operators have precedence above each other, meaning some of them will be evaluated before others. Here is the list of operators in the descending order.
Operators | Description | Example |
---|---|---|
.
|
Dot operator, used to access object properties and methods | foo.bar , bar.foo() |
+ – |
Unary operation plus and minus operators | +foo , –bar |
* / % |
Multiplication, division and modulus operations | foo * bar
|
+ – |
Addition and subtraction operators | foo – bar
|
== != < > <= >= |
Equal, not equal, less, greater, less or equal, greater or equal operators | foo != bar
|
<>
|
Alias for != |
|
=~
|
Match operator; right-hand operand is a string containing wildcard expression to match left-hand operand | foo =~ "bar*"
|
in
|
Set inclusion operator | foo in (bar1, bar2)
|
! not |
Logical negation operator | !foo , not foo =~ "bar*"
|
&& and |
Logical conjunction operator | foo1 == bar1 && foo2 != bar2
|
|| or |
Logical disjunction operator | foo1 == bar1 || foo2 != bar2
|
Boolean expressions
Any complete expression used as display style match expression and any part of this expression used as operand with comparison, match and logical operators has to evaluate to boolean. It is also possible to use expressions evaluating string and numeric values, in which case they will be cast to boolean by the following rules:
Operand type | Description |
---|---|
Boolean | As is |
String | True if not empty, false otherwise |
Integer/Real Number | True if not zero, false otherwise |
Management extensions
There are some useful extensions present to ease expressions writing.
Time duration extensions
All time-related operations are performed in seconds. Though you may simply write 5 * 60
to express 5 minutes, it is more readable and convenient to use one of the following helper functions:
Function | Description |
---|---|
day() , days() |
Aliases, return X days as a number of seconds |
hour() , hours() |
Aliases, return X hours as a number of seconds |
minute() , minutes() |
Aliases, return X minutes as a number of seconds |
month() , months() |
Aliases, return X months as a number of seconds (approximating to 30 days in one month) |
second() , seconds() |
Aliases, return X itself |
week() , weeks() |
Aliases, return X weeks as a number of seconds |
year() , years() |
Aliases, return X years as a number of seconds (approximating to 365.25 days in one year) |
For an example, see the "Duration Object" section.
Size extensions
All size-related operations are performed in bytes. You may as well write 15 * 1000 * 1000 * 1000
to express 15 gigabytes, but it is easier to use one of the following helpers:
Function | Description |
---|---|
kilo() , kibi() |
Return X kilo- (×1000) or kibibytes (×1024) as a number of bytes |
mega() , mebi() |
Return X mega- (×10002) or mebibytes (×10242) as a number of bytes |
giga() , gibi() |
Return X giga- (×10003) or gibibytes (×10243) as a number of bytes |
tera() , tebi() |
Return X tera- (×10004) or tebibytes (×10244) as a number of bytes |
peta() , pebi() |
Return X peta- (×10005) or pebibytes (×10245) as a number of bytes |
exa() , exbi() |
Return X exa- (×10006) or exbibytes (×10246) as a number of bytes |
zetta() , zebi() |
Return X zetta- (×10007) or zebibytes (×10247) as a number of bytes |
yotta() , yobi() |
Return X yotta- (×10008) or yobibytes (×10248) as a number of bytes |
For example, you could write us > 10.giga() && us < 20.tera()
to select devices with used storage size between 10 gigabytes and 20 terabytes.
If you feel uncomfortable with those units differences, please refer to Wikipedia article on binary prefixes.
Duration Object
When there is a need in comparing time column values against some time relative to another, these helper functions may come in handy:
Function | Description |
---|---|
until(T)
|
Return Time object corresponding to X seconds before T |
ago()
|
Alias to X.until(Time.now()) |
since(T)
|
Return Time object corresponding to X seconds after T |
from_now()
|
Alias to X.since(Time.now()) |
For example, you can write ts < 20.minutes().ago()
to select devices which have been inactive for the last 20 minutes.
Time Class
Function | Description |
---|---|
now()
|
Return Time object corresponding to current time |
For example, you could write ts > Time.now()
to select devices with incorrect time settings (naturally, no device could report its last activity time which is later than the current time).
Session Class
Number | Property | Description |
---|---|---|
1 | In progress | The session is still running. |
2 | Failed | The session failed. |
3 | Aborted | The session was aborted. |
5 | Completed | The session was successful. |
6 | Interrupted | The session was interrupted because of a BackupFP crash during the system's scanning at the beginning of the session |
7 | Not Started | The device has no sessions at all |
8 | Completed With Errors | The last session was completed with errors |
9 | In Progress With Faults | A corresponding session status |
10 | Over Quota | The selection exceeds the limits |
For example, you can write t0
in (Session.Completed, Session.CompletedWithErrors)
to select devices having the "Completed" or "Completed with errors" total session status.