第15章 Searching and Bookmarking

The Satellite web UI features powerful search functionality which is available on most pages of the web UI. It enables you to search all kinds of resources that Satellite Server manages. Searches accept both free text and syntax-based queries, which can be built using extensive input prediction. Search queries can be saved as bookmarks for future reuse.

15.1. Building Search Queries

As you start typing a search query, a list of valid options to complete the current part of the query appears. You can either select an option from the list and keep building the query using the prediction, or continue typing. To learn how free text is interpreted by the search engine, see 「Using Free Text Search」.

15.1.1. Query Syntax

parameter operator value

Available fields, resources to search, and the way the query is interpreted all depend on context, that is, the page where you perform the search. For example, the field "hostgroup" on the Hosts page is equivalent to the field "name" on the Host Groups page. The field type also determines available operators and accepted values. For a list of all operators, see Operators. For descriptions of value formats, see Values.

15.1.2. Operators

All operators that can be used between parameter and value are listed in the following table. Other symbols and special characters that might appear in a prediction-built query, such as colons, do not have special meaning and are treated as free text.

表15.1 Comparison Operators Accepted by Search

OperatorShort NameDescriptionExample

=

EQUALS

Accepts numerical, temporal, or text values. For text, exact case sensitive matches are returned.

hostgroup = RHEL7

!=

NOT EQUALS

~

LIKE

Accepts text or temporal values. Returns case insensitive matches. Accepts the following wildcards: _ for a single character, % or * for any number of characters including zero. If no wildcard is specified, the string is treated as if surrounded by wildcards: %rhel7%

hostgroup ~ rhel%

!~

NOT LIKE

>

GREATER THAN

Accepts numerical or temporal values. For temporal values, the operator > is interpreted as "later than", and < as "earlier than". Both operators can be combined with EQUALS: >= <=

registered_at > 10-January-2017
The search will return hosts that have been registered after the given date, that is, between 10th January 2017 and now.

registered_at <= Yesterday
The search will return hosts that have been registered yesterday or earlier.

<

LESS THAN

^

IN

Compares an expression against a list of values, as in SQL. Returns matches that contain or not contain the values, respectively.

release_version !^ 7

!^

NOT IN

HAS or set?

 

Returns values that are present or not present, respectively.

has hostgroup or set? hostgroup
On the Puppet Classes page, the search will return classes that are assigned to at least one host group.

not has hostgroup or null? hostgroup
On the Dashboard with an overview of hosts, the search will return all hosts that have no assigned host group.

NOT HAS or null?

 

Simple queries that follow the described syntax can be combined into more complex ones using logical operators AND, OR, and NOT. Alternative notations of the operators are also accepted:

表15.2 Logical Operators Accepted by Search

OperatorAlternative NotationsExample

and

&

&&

<whitespace>

class = motd AND environment ~ production

or

|

||

 

errata_status = errata_needed || errata_status = security_needed

not

!

 

hostgroup ~ rhel7 not status.failed

15.1.3. Values

Text Values

Text containing whitespaces must be enclosed in quotes. A whitespace is otherwise interpreted as the AND operator.

Examples:

hostgroup = "Web servers"

The search will return hosts with assigned host group named "Web servers".

hostgroup = Web servers

The search will return hosts in the host group Web with any field matching %servers%.

Temporal Values

Many date and time formats are accepted, including the following:

  • "10 January 2017"
  • "10 Jan 2017"
  • 10-January-2017
  • 10/January/2017
  • "January 10, 2017"
  • Today, Yesterday, and the like.
警告

Avoid ambiguous date formats, such as 02/10/2017 or 10-02-2017.