view
Use the view stage to customize how your query results are displayed, enabling highlighting, graphing, and column reordering.
Syntax
view highlight fields = <field1>[,<field2>,...] values = <value1>[,<value2>,...]
view graph type = <graph_type> xaxis = <field1> yaxis = <field2> [<optional parameters>] [series = <field3>]
view column order = default | populatedParameters
highlight
keyword
No
Indicates the view operation is to highlight specific text.
fields
string
Yes (for highlight)
A comma-separated list of fields in which to search for the value to highlight.
values
string
Yes (for highlight)
A comma-separated list of string values to highlight within the specified fields.
graph
keyword
No
Indicates the view operation is to generate a graph.
type
string
Yes (for graph)
Specifies the type of graph (for example, pie, column, area, bubble, line, map, scatter).
xaxis
string
Yes (for graph)
The field to be used for the X-axis. Must be collatable.
yaxis
string
Yes (for graph)
The field to be used for the Y-axis. Must be collatable.
series
string
No
Used for certain graph types (area, bubble, column, line, map, scatter) to group chart results based on this field's values.
column order
keyword
No
Indicates the view operation is to reorder columns.
default
keyword
No
Displays columns in their original order.
populated
keyword
No
Displays columns with the most non-null values first.
Returns
The view stage returns the query results formatted according to the specified visualization or ordering rules.
Usage notes
For graph types, the fields specified for
xaxisandyaxismust be collatable.The
seriesparameter is available for specific graph types (area,bubble,column,line,map,scatter) to group chart results based onyaxisvalues.The
view column orderoption applies only to the Query Builder's display and is disregarded in widgets, Correlation Rules, public APIs, reports, and dashboards.
Examples
Example 1: Highlighting specific values
Goal: Highlight the text "successful" wherever it appears within the event_description field.
XQL code:
Explanation: This query will display the records and visually highlight the text "successful" in the event_description column (for example, in "User login successful").
Output:
101
"User login successful"
102
"File access attempt"
103
"Network connection established"
Example 2: Visualizing categorical data (Pie chart)
Goal: Create a pie chart showing the count of events grouped by their is_successful status.
XQL code:
Explanation: This query counts the total number of events for each is_successful status (true or false). The query then displays these counts as a pie chart, where is_successful defines the slices (xaxis) and event_count defines their size (yaxis).
Output:
true
7
false
3
Example 3: Trend analysis (column graph)
Goal: Display a column graph showing the count of events per hour.
XQL code:
Explanation: This query groups events into one-hour bins based on _time, counts the hourly_events for each bin, and presents the data as a column graph showing the hourly distribution.
Output:
2023-10-26 10:00:00 UTC
9
2023-10-26 11:00:00 UTC
1
Example 4: Adding granularity to graphs (series)
Goal: Show the sum of duration_seconds over time, segmented by is_successful status using a series.
XQL code:
Explanation: This query aggregates duration_seconds by hourly _time buckets and is_successful status. The view stage creates a column graph where each hour is represented, segmented by the success status.
Output:
2023-10-26 10:00:00 UTC
true
39.9
2023-10-26 10:00:00 UTC
false
2.95
2023-10-26 11:00:00 UTC
true
60.0
Example 5: Prioritizing display (column order)
Goal: Reorder the columns in the results table to display columns with the most non-null values first.
XQL code:
Explanation: This query counts events by is_successful and then reorders the resulting columns. Columns that are consistently populated appear earlier in the table view.
Output:
true
7
false
3
Related articles
Last updated
Was this helpful?
