Manually creating an SQL query
You can use the search field manually to create SQL queries of any complexity to filter events.
To manually generate an SQL query:
- Go to the Events section of the KUMA web interface.
An input form opens.
- Enter your SQL query into the input field. You must use single quotes in your queries.
- Click Run query to run the query.
A table of events that satisfy the criteria of your query will be displayed. If necessary, you can filter events by period.
Supported functions and operators
Function |
Description |
---|---|
|
Event fields that you want to be returned. The following functions and operators are supported:
You can combine functions and operators in an SQL query. If you use aggregation functions in an SQL query, you can customize the display of columns in the event table. After executing the query without *, the columns will match the query. Sorting of events in ascending and descending order, getting statistics is also not possible. If the query uses grouping or aggregation functions, instead of one number that was received as a response to the "SELECT max(BytesOut) FROM `events` LIMIT 250" query, the radar displays the distribution of events from which this number was obtained. |
|
Data source. When creating an SQL query, you need to specify the events value as the data source. |
|
Conditions for filtering events:
|
|
Event fields or aliases to be used for grouping the returned data. If you use data grouping in an SQL query, custom fields specified in the query are displayed in the list of events. Table columns in a group cannot be customized. In group events, you can customize the display of columns. Sorting of events in ascending and descending order, getting statistics is also not possible. |
|
Columns by which you want to sort the returned data. Possible values:
|
|
The number of rows to skip before displaying the results of the SQL query. |
|
The number of rows that can be displayed in the table. The default value is If you are filtering events by user-defined period and the number of rows in the search results exceeds the defined value, you can click the Show next button to display additional rows in the table. This button is not displayed when filtering events by the standard period. |
Examples of SQL 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 field and then switched to the builder, the SQL query parameters are not transferred to the builder. In this case, you will need to re-create the SQL query in the builder. The SQL query created in the builder does not overwrite the SQL query that was entered into the search string until you click the Apply query button in the builder window. If you created an SQL query in the query builder and then switched to the search field, 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.