With Dynatrace on Grail, you can use the following Dynatrace Query Language (DQL) functions and logical operators in matchers for business event processing:
Filters records containing a specified phrase. Returns only matching records. This function is case insensitive for ASCII characters, it works with multi-value attributes (matching any of the values), and the asterisk character (*) is a wildcard only referring to a single term, not the whole field value.
Validation
The matchesPhrase function performs case-insensitive contains for the whole query string and doesn't support mid-string wildcards.
For found results, additional validation takes place:
Syntax
matchesPhrase(expression, phrase [, caseSensitive])
Parameters
| Name | Type | Mandatory | Default | Constraints | Description |
|---|---|---|---|---|---|
expression | string, array | yes | The expression (string or array of strings) that should be checked. | ||
phrase | string | yes | The phrase to search for. | ||
caseSensitive | boolean | no | false | This optional parameter ( | Whether the match should be done case-sensitive. |
Example
In this example, you add a filter that matches log records that contain error phrase in their content.
matchesPhrase(content, "error")
| Part of the input event | Processing query | Match result | Description |
|---|---|---|---|
|
| Exact match by single term. | |
|
| Non-word character is expected after character | |
|
| The query would match all IPs with the last octet between | |
|
| Exact phrase match. | |
|
|
| |
|
| If the query ends with a wildcard character, the validation of the succeeding character is skipped. | |
|
|
| |
|
| If the query starts with a wildcard character, the validation of the preceding character is skipped. | |
|
| If the query starts and ends with a wildcard character, the validation of the preceding and succeeding characters is skipped. | |
|
| There should be an apostrophe ( | |
|
| Non-ASCII character | |
|
| If the query starts with non-word character, the validation of the preceding character is skipped. | |
|
| There is a space in the query and a tabulator in the attribute value. | |
|
| There is a single space in the query and a double space in the attribute value | |
|
| It is possible to search with multiple spaces. | |
|
| The function handles multi-value attributes in "any-match" manner, in this case | |
|
| Wildcard can be used also when dealing with multi-value attributes. |
Searches the records for a specific value in a given attribute. Returns only matching records. This function is case insensitive for ASCII characters, it works with multi-value attributes (matching any of the values), and it doesn't support mid-value wildcards.
Syntax
matchesValue(expression, value [, caseSensitive])
Parameters
| Name | Type | Mandatory | Default | Constraints | Description |
|---|---|---|---|---|---|
expression | string, array | yes | The expression (value or array of values) that should be checked. | ||
value | string | yes | The value to search for. | ||
caseSensitive | boolean | no | false | This optional parameter ( | Whether the match should be done case-sensitive. |
Example
In this example, you add a filter record where process.technology attribute contains nginx value.
matchesValue(process.technology, "nginx")
| Part of the input event | Processing query | Match result | Description |
|---|---|---|---|
|
| Case insensitive equality. | |
|
| The whole attribute value is considered. | |
|
| The value ends with | |
|
| The value starts with | |
|
| The value contains the string | |
|
| Case insensitive only for ASCII characters. | |
|
| Exact match. | |
|
| The function handles multi-value attributes in "any-match" manner, in this case, | |
|
| None of the values is equal to string java. | |
|
| Both values start with a string |
Tests if a value is not NULL.
Syntax
isNotNull(<value>)
Example
In this example, we filter (select) data where the host.name field contains a value.
isNotNull(`host.name`)
| timestamp | content | event.type | host.name |
|---|---|---|---|
|
|
|
|
Examples of event processing using DQL isNotNull function.
| Part of the input event | Processing query | Match result | Description |
|---|---|---|---|
|
| The | |
|
| The | |
|
| The |
Tests if a value is NULL.
Syntax
isNull(<value>)
Example
In this example, we filter (select) data where the host.name field doesn't contain a value.
filter isNull(`host.name`)
| timestamp | content | event.type | host.name |
|---|---|---|---|
|
|
|
| Part of the input event | Processing query | Match result | Description |
|---|---|---|---|
|
| The | |
|
| The | |
|
| The |
Logical operators can be used to connect two or more expressions. Check out Logical or equality operators to find out more about the behavior of logical operators in DQL.
Logical addition.
Syntax
<expression_1> or <expression_2>
Example
In this example, you add a matcher to filter records where the content contains either timestamp phrase or trigger phrase.
matchesPhrase(content, "timestamp") or matchesPhrase(content, "trigger")
Logical multiplication.
Syntax
<expression_1> and <expression_2>
Example
In this example, you add a matcher to filter records where the content contains timestamp phrase and trigger phrase.
matchesPhrase(content, "timestamp") and matchesPhrase(content, "trigger")
Logical negation.
Syntax
not <expression>
Example
In this example, you add a matcher to filter records where the content doesn't contain timestamp phrase.
not matchesPhrase(content, "timestamp")
Logical operator (==) indicating an exact match.
Data types need to be identical. However, if the decimal value is 0, floating numbers can be compared with integer data. For example, 1==1.0
For strings, the search is case-sensitive.
Contrary to matchesValue function, strict equality operator performs case-sensitive comparison, doesn't support wildcards and doesn't operate on elements being part of multi-value attributes.
Syntax
<expression1> == <expression2>
Examples
Examples of using the strict equality operator.
| Part of the input event | Processing query | Match result | Description |
|---|---|---|---|
|
| The attribute is of the string type and has the same value. | |
|
| The strict equality is case-sensitive. | |
|
| The attributes have different data types | |
|
| Floating numbers can be compared to integer values if their decimals equal 0 | |
|
| The attributes have different data types. |
You can create conditional grouping with brackets ( ).
matchesValue(process.technology, "nginx") and ( matchesPhrase(content, "error") or matchesPhrase(content, "warn") )
All the matcher expressions used in either log events, metrics, processing or bucket configurations are valid DQL. That means you can also use these expressions together with DQL filter command, for example, in the log viewer.