Advanced Resource SearchProvides rules and syntax for using the Advance Resource Search query language feature.Leave FeedbackIntroductionAdvanced search provides the ability to find resources by leveraging a query language based on resource attributes. By default, the resource attributes displayed on the Resources page are inherited.Search queries allow:Searching for resources by a combination of resource attributes.Performing actions on selected resources.Gaining insight into discovered resources.FunctionalityTo form a query, start with the dollar sign ($) and then use a combination of the following:Clause operators (for example, AND and OR)Mathematical operators (for example, = and !=)Key value pairs (for example, $key = "value") .NoteEvery query has at least one mathematical operator and some may include a clause operator.Clause operatorsClause operators behave in the following manner:An AND clause operator returns results if and only if both conjuncts (the key and value pair on either side of the AND operator) evaluate as true.An OR clause operator returns results if either of the disjuncts (the key and value pair on either side of the OR operator) evaluates as true.NoteThe OR operator operates on the laws of the inclusive OR. For example, when either disjunct is true, the query evaluate as true.The following table shows the supported clause operators:Clause OperatorsOperatorFunctionANDEvaluates two key value pairs and returns true if and only if both conjuncts are true .OREvaluates two key value pairs and returns true if either disjuncts are true .Parentheses ()Separates clauses into logical disjuncts or conjuncts. Used to assign a primary clause operator in the case of an AND/OR race condition.Quotations ""For values in key value pairs that contain non-integer values.For example: $key = "abc"Mathematical operatorsThe following table shows the supported mathematical operators:Mathematical OperatorsOperatorFunction!=Expresses whether either operand is not equal to each other.=Expresses whether either operand is equal to each other.CONTAINSString matching that searches for similar text strings in the value.NOT CONTAINSString matching that searches for dissimilar text strings in the value.ISEvaluates for binary values such as EMPTY or NOT EMPTY.IS NULLEvaluates whether the token value does not contains any entry.For example: $key: ""IS NOT NULLEvaluates whether the token value contains any entry and is not empty.For example: $key: "abc"Key value pairsFor advanced search, key value pairs:Represent a resource attribute and its value.Are evaluated against the mathematical operators that combine them. For example, $key = "value".Are separated by either an AND or an OR.For example, the following query syntax shows two key value pairs:key = "value" AND $key = "value" AttributesThe following table shows the available attributes:AttributesAttributesDescriptionNativeIncludes all native OpsRamp resource attributes.For example: hostname, resourcetype, approles.nameCustomIncludes all user assigned custom attributes.For example: customattribute1, customattribute2Note: Custom attributes are listed under $tags.name and $tags.value.ExamplesExample: Using the AND operatorFor the following query example:If both conditions are met, the query evaluation is true and results are returned.If the conditions are not met, the query evaluation is false and no results are returned.$hostname = "123" AND $DNSName = "www"Example: Using the OR operatorFor the following query example:If one condition is met, the query evaluation is true and results are returned.If no conditions are met, the query evaluation is false and no results are returned.$hostname = "123" OR $DNSName = "www"Example: Using multiple clause operatorsWhen queries contain multiple clause operations, the following occurs:The AND operator is evaluated first.The OR operator is evaluated second.For example:$hostname = "123" OR $DNSName = "www" AND $approle.name = "SQL" Example: Assigning primary clause operatorsTo assign a primary clause operator in a query, use parentheses () to close the clause.For example:$hostname= "123" OR ($DNSName = "www" AND $approle.name = "SQL")Example: Using parenthesesWhen parentheses are added, the following occurs:The query against the primary operator is evaluated first.Clauses in the parentheses are treated as a single disjunct or conjunct.In the following example: A single truth value is assigned (true or false).($DNSName = "www" AND $approle.name = "SQL")Assuming the following evaluations:$hostname = "123" evaluates as true.$DNSName = "www" AND $approle.name = "SQL" evaluates as true.The expected result returns all resources for one of the following conditions:$hostname = "123".$DNSName = "www" and $approle.name = "SQL".