You can use the search string to manually create SQL queries of any complexity for filtering events.
To manually generate an SQL query:
An input form opens.
You will see a table of events that satisfy the criteria of your query. If necessary, you can filter events by period.
Supported functions and operators
SELECT
—event fields that should be returned.For SELECT
fields, the program supports the following functions and operators:
count, avg, max, min, sum
.+, -, *, /, <, >, =, !=, >=, <=
.You can combine these functions and operators.
If you are using aggregation functions in a query, you cannot customize the events table display, sort events in ascending or descending order, or receive statistics.
DISTINCT
–removes duplicates from the result of a SELECT statement. You must use the following notation: SELECT DISTINCT SourceAddress as Addresses FROM <rest of the query
>.
FROM
—data source.When creating a query, you need to specify the events value as the data source.
WHERE
—conditions for filtering events.AND, OR, NOT, =, !=, >, >=, <, <=
IN
BETWEEN
LIKE
ILIKE
inSubnet
match
(the re2 syntax of regular expressions is used in queries, special characters must be shielded with backslash "\")GROUP BY
—event fields or aliases to be used for grouping the returned data.If you are using data grouping in a query, you cannot customize the events table display, sort events in ascending or descending order, receive statistics, or perform a retroscan.
ORDER BY
—columns used as the basis for sorting the returned data.Possible values:
DESC
—descending order.ASC
—ascending order.OFFSET
—skip the indicated number of lines before printing the query results output.LIMIT
—number of strings displayed in the table.The default value is 250. You can specify an arbitrary value.
If you are filtering events by user-defined period and the number of strings in the search results exceeds the defined value, you can click the Show next button to display additional strings in the table. This button is not displayed when filtering events by the standard period.
Example queries:
|
If you want to use a special character in a query, you need to escape this character by placing a backslash (\) character in front of it.
Example:
In the events table, all events whose Message field contains text corresponding to the |
When creating a normalizer for events, you can choose whether to retain the field values of the raw event. The data is stored in the Extra event field. This field is searched for events by using the LIKE operator.
Example:
In the events table, all events for hosts with the IP address 00.00.00.000 where the example process is running are sorted by the Timestamp column in descending order. The number of strings that can be displayed in the table is 250. |
If you created an SQL query manually in the search string and then switched to the query builder, the query parameters are not transferred to the query builder; you must re-create the query in the builder. Also, the query created in the builder does not overwrite the query that was entered into the search string until you click the Apply query button in the builder window. If you created a query in the query builder and then switched to the search string, the query parameters are transferred automatically.
Aliases must not contain spaces.
For more details on SQL, refer to the ClickHouse documentation. See also the supported ClickHouse functions.