Data in stroom (and in external Elastic indexes) can be searched using a number of ways:
Dashboard
Combines multiple query expressions, result tables and visualisations in one configurable layout.
Query
Executes a single search query written in StroomQlStroomQl
StroomQuery Language is Stroom’s own query language. It has similarities with Structured Query Language (SQL) as used in databases. StroomQL is sometimes referred to as sQL to distinguish it from SQL.
Click to see more details... and displays the results as a table or visualisation.
StroomQuery Language is Stroom’s own query language. It has similarities with Structured Query Language (SQL) as used in databases. StroomQL is sometimes referred to as sQL to distinguish it from SQL.
Click to see more details... search query either against data as it is ingested into Stroom or on a scheduled basis.
StroomQuery Language is Stroom’s own query language. It has similarities with Structured Query Language (SQL) as used in databases. StroomQL is sometimes referred to as sQL to distinguish it from SQL.
Click to see more details... search query on a scheduled basis and delivers the results as a file by email or to a feed.
1 - Data Sources
Stroom has multiple different types of data sources that can be queried by Stroom using Dashboards, Queries and Analytic Rules.
1.1 - Lucene Index Data Source
Stroom’s own Lucene based index for indexing and searching its stream data.
Stroom’s primary data source is its internal Lucene based search indexes.
For details of how data is indexed see Lucene Indexes.
TODO
Complete this section
1.2 - Statistics
Using Stroom’s statistic stores as a data source.
TODO
Complete this section
1.3 - Elasticsearch
Using Elasticsearch as a data source.
Stroom can integrate with external Elasticsearch indexes to allow querying using Stroom’s various mechanisms for querying data sources.
These indexes may have been populated using a Stroom pipeline (See here).
Searching Using a Stroom Dashboard
Searching an Elasticsearch index (or data stream) using a Stroom dashboard is conceptually similar to the process described in Dashboards.
Before you set the dashboard’s data source, you must first create an Elastic Index document to tell Stroom which index (or indices) you wish to query.
Create an Elastic Index Document
Right-click a folder in the Stroom Explorer pane ().
Select:
New
Elastic Index
Enter a name for the index document and click
OK
.
Click next to the Cluster configuration field label.
In the dialog that appears, select the Elastic Cluster document where the index exists, and click
OK
.
Enter the name of an index or data stream in Index name or pattern.
Data view (formerly known as index pattern) syntax
is supported, which enables you to query multiple indices or data streams at once.
For example: stroom-events-v1.
(Optional) Set Search slices, which is the number of parallel workers that will query the index.
For very large indices, increasing this value up to and including the number of shards can increase scroll performance, which will allow you to download results faster.
(Optional) Set Search scroll size, which specifies the number of documents to return in each search response.
Greater values generally increase efficiency.
By default, Elasticsearch limits this number to 10,000.
Click Test Connection.
A dialog will appear with the result, which will state Connection Success if the connection was successful and the index pattern matched one or more indices.
Click .
Set the Elastic Index Document as the Dashboard Data Source
Open or create a dashboard.
Click in the Query panel.
Click next to the Data Source field label.
Select the Elastic Index document you created and click
OK
.
Configure the query expression as explained in Dashboards.
Note the tips for particular Elasticsearch field mapping data types.
Certain Elasticsearch field mapping types support special syntax when used in a Stroom dashboard query expression.
To identify the field mapping type for a particular field:
Click in the Query panel to add a new expression item.
Select the Elasticsearch field name in the drop-down list.
Note the blue data type indicator to the far right of the row.
Common examples are: keyword, text and number.
After you identify the field mapping type, move the mouse cursor over the mapping type indicator.
A tooltip appears, explaining various types of queries you can perform against that particular field’s type.
Searching Multiple Indices
Using data view (index pattern) syntax, you can create powerful dashboards that query multiple indices at a time.
An example of this is where you have multiple indices covering different types of email systems.
Let’s assume these indices are named: stroom-exchange-v1, stroom-domino-v1 and stroom-mailu-v1.
There is a common set of fields across all three indices: @timestamp, Subject, Sender and Recipient.
You want to allow search across all indices at once, in effect creating a unified email dashboard.
You can achieve this by creating an Elastic Index document called (for example) Elastic-Email-Combined and setting the property Index name or pattern to: stroom-exchange-v1,stroom-domino-v1,stroom-mailu-v1.
Click and re-open the dashboard.
You’ll notice that the available fields are a union of the fields across all three indices.
You can now search by any of these - in particular, the fields common to all three.
1.4 - Internal Data Sources
A set of data sources for querying the inner workings of Stroom.
Stroom provides a number of built in data sources for querying the inner workings of stroom.
These data sources do not have a corresponding DocumentDocument
Typically refers to an item that can be created in the Explorer Tree, e.g. a Feed, a Pipeline, a Dashboard, etc. May also be known as an Entity.
Click to see more details... so do not feature in the explorer tree.
These data sources appear as children of the root folder when selecting a data source in a Dashboard , View .
They are also available in the list of data sources when editing a Query .
Analytics
TODO
Complete
Annotations
Annotations are a means of annotating search results with additional information and for assigning those annotations to users.
The Annotations data source allows you to query the annotations that have been created.
Field
Type
Description
annotation:Id
Long
Annotation unique identifier.
annotation:CreatedOn
Date
Date created.
annotation:CreatedBy
String
Username of the user that created the annotation.
annotation:UpdatedOn
Date
Date last updated.
annotation:UpdatedBy
String
Username of the user that last updated the annotation.
annotation:Title
String
annotation:Subject
String
annotation:AssignedTo
String
Username the annotation is assigned to.
annotation:Comment
String
Any comments on the annotation.
annotation:History
String
History of changes to the annotation.
Dual
The Dual data source is one with a single field that always returns one row with the same value.
This data source can be useful for testing expression functions.
It can also be useful when combined with an extraction pipeline that uses the stroom:http-call() XSLT function in order to make a single HTTP call using Dashboard parameter values.
Field
Type
Description
Dummy
String
Always one row that has the value X
Index Shards
Exposes the details of the index shards that make up Stroom’s Lucene based index.
Each index is split up into one or more partitions and each partition is further divided into one or more shards.
Each row represents one index shard.
Field
Type
Description
Node
String
The name of the node that the index belongs to.
Index
String
The name of the index document.
Index Name
String
The name of the index document.
Volume Path
String
The file path for the index shard.
Volume Group
String
The name of the volume group the index is using.
Partition
String
The name of the partition that the shard is in.
Doc Count
Integer
The number of documents in the shard.
File Size
Long
The size of the shard on disk in bytes.
Status
String
The status of the shard (Closed, Open, Closing, Opening, New, Deleted, Corrupt).
Last Commit
Date
The time and date of the last commit to the shard.
Meta Store
Exposes details of the streams held in Stroom’s StreamStream
A Stream is the unit of data that Stroom works with and will typically contain many Events.
Click to see more details... (aka meta) store.
Each row represents one stream.
Field
Type
Description
Feed
String
The name of the feed the stream belongs to.
Pipeline
String
The name of the pipeline that created the stream. [Optional]
Pipeline Name
String
The name of the pipeline that created the stream. [Optional]
Status
String
The status of the stream (Unlocked, Locked, Deleted).
All Streams must have a Stream Type. The list of Stream Types is configured using the Propertystroom.data.meta.metaTypes.
Click to see more details..., e.g. Events, Raw Events, etc.
Id
Long
The unique ID (within this Stroom cluster) for the stream .
Parent Id
Long
The unique ID (within this Stroom cluster) for the parent stream, e.g. the Raw stream that spawned an Events stream. [Optional]
Processor Id
Long
The unique ID (within this Stroom cluster) for the processor that produced this stream. [Optional]
Processor Filter Id
Long
The unique ID (within this Stroom cluster) for the processor filter that produced this stream. [Optional]
Processor Task Id
Long
The unique ID (within this Stroom cluster) for the processor task that produced this stream. [Optional]
Create Time
Date
The time the stream was created.
Effective Time
Date
The time that the data in this stream is effective for. This is only used for reference data streams and is the time that the snapshot of reference data was captured. [Optional]
Status Time
Date
The time that the status was last changed.
Duration
Long
The time it took to process the stream in milliseconds. [Optional]
Read Count
Long
The number of records read in segmented streams. [Optional]
Write Count
Long
The number of records written in segmented streams. [Optional]
Info Count
Long
The number of INFO messages.
Warning Count
Long
The number of WARNING messages.
Error Count
Long
The number of ERROR messages.
Fatal Error Count
Long
The number of FATAL_ERROR messages.
File Size
Long
The compressed size of the stream on disk in bytes.
Raw Size
Long
The un-compressed size of the stream on disk in bytes.
Processor Tasks
Exposes details of the tasks spawned by the processor filters.
Each row represents one processor task.
Field
Type
Description
Create Time
Date
The time the task was created.
Create Time Ms
Long
The time the task was created (milliseconds).
Start Time
Date
The time the task was executed.
Start Time Ms
Long
The time the task was executed (milliseconds).
End Time
Date
The time the task finished.
End Time Ms
Long
The time the task finished (milliseconds).
Status Time
Date
The time the status of the task was last updated.
Status Time Ms
Long
The time the status of the task was last updated (milliseconds).
Meta Id
Long
The unique ID (unique within this Stroom cluster) of the stream the task was for.
Node
String
The name of the node that the task was executed on.
Pipeline
String
The name of the pipeline that spawned the task.
Pipeline Name
String
The name of the pipeline that spawned the task.
Processor Filter Id
Long
The ID of the processor filter that spawned the task.
Processor Filter Priority
Integer
The priority of the processor filter when the task was executed.
Processor Id
Long
The unique ID (unique within this Stroom cluster) of the pipeline processor that spawned this task.
Feed
String
Status
String
The status of the task (Created, Queued, Processing, Complete, Failed, Deleted).
Task Id
Long
The unique ID (unique within this Stroom cluster) of this task.
Reference Data Store
Warning
This data source is for advanced users only and is primarily aimed at debugging issues with reference data.
Reference data is written to a persistent cache on storage local to the node.
This data source exposes the data held in the store on the local node only.
Given that most Stroom deployments are clustered and the UI nodes are typically not doing processing, this means the UI node will have no reference data.
Task Manager
This data source exposes the background tasks currently running across the Stroom cluster.
Each row represents a single background server task.
Requires the Manage Tasks application permission.
Field
Type
Description
Node
String
The name of the node that the task is running on.
Name
String
The name of the task.
User
String
The user name of the user that the task is running as.
Submit Time
Date
The time the task was submitted.
Age
Duration
The time the task has been running for.
Info
String
The latest information message from the task.
2 - Dashboards
A Dashboard document is a way to combine multiple search queries, tables and visualisations in a configurable layout.
2.1 - Queries
How to query the data in Stroom.
Dashboard queries are created with the query expression builder.
The expression builder allows for complex boolean logic to be created across multiple index fields.
The way in which different index fields may be queried depends on the type of data that the index field contains.
Date Time Fields
Time fields can be queried for times equal, greater than, greater than or equal, less than, less than or equal or between two times.
Times can be specified in two ways:
Absolute times
Relative times
Absolute Times
An absolute time is specified in ISO 8601 date time format, e.g. 2016-01-23T12:34:11.844Z
Relative Times
In addition to absolute times it is possible to specify times using expressions.
Relative time expressions create a date time that is relative to the execution time of the query.
Supported expressions are as follows:
now() - The current execution time of the query.
second() - The current execution time of the query rounded down to the nearest second.
minute() - The current execution time of the query rounded down to the nearest minute.
hour() - The current execution time of the query rounded down to the nearest hour.
day() - The current execution time of the query rounded down to the nearest day.
week() - The current execution time of the query rounded down to the first day of the week (Monday).
month() - The current execution time of the query rounded down to the start of the current month.
year() - The current execution time of the query rounded down to the start of the current year.
Adding/Subtracting Durations
With relative times it is possible to add or subtract durations so that queries can be constructed to provide for example, the last week of data, the last hour of data etc.
To add/subtract a duration from a query term the duration is simply appended after the relative time, e.g.
now() + 2d
Multiple durations can be combined in the expression, e.g.
now() + 2d - 10h
now() + 2w - 1d10h
Durations consist of a number and duration unit.
Supported duration units are:
s - Seconds
m - Minutes
h - Hours
d - Days
w - Weeks
M - Months
y - Years
Using these durations a query to get the last week’s data could be as follows:
between now() - 1w and now()
Or midnight a week ago to midnight today:
between day() - 1w and day()
Or if you just wanted data for the week so far:
greater than week()
Or all data for the previous year:
between year() - 1y and year()
Or this year so far:
greater than year()
2.2 - Internal Links
Adding links within Stroom to internal features/items or external URLs.
Within Stroom, links can be created in dashboard tables or dashboard text panes that will direct Stroom to display an item in various ways.
Links are inserted in the form:
[Link Text](URL and parameters){Link Type}
In dashboard tables links can be inserted using the link() function or more specialised functions such as data() or stepping().
In dashboard text panes, links can be inserted into the HTML as link attributes on elements.
Note
The text pane must be set to Show As HTML for links to operate.
<div style="padding: 5px;">
<span style="text-decoration:underline;color:blue;cursor:pointer" link="[link](uuid=e177cf16-da6c-4c7d-a19c-09a201f5a2da&params=user%3Duser1&title=Details%20For%20user1){dashboard}">Details For user1</span>
</div>
The link type can be one of the following:
dialog : Display the content of a link URL within a stroom popup dialog.
tab : Display the content of a link URL within a stroom tab.
browser : Display the content of a link URL within a new browser tab.
dashboard : Used to launch a Stroom dashboard internally with parameters in the URL.
stepping : Used to launch Stroom stepping internally with parameters in the URL.
data : Used to show Stroom data internally with parameters in the URL.
annotation : Used to show a Stroom annotation internally with parameters in the URL.
Dialog
Dialog links are used to embed any referenced URL in a Stroom popup Dialog.
Dialog links look something like this in HTML:
<div style="padding: 5px;">
<span style="text-decoration:underline;color:blue;cursor:pointer"
link="[Show](https://www.somehost.com/somepath){dialog|Embedded In Stroom}">
Show In Stroom Dialog
</span>
</div>
Note
The dialog title can be controlled by adding a | and required title after the type, e.g.
{dialog|Embedded In Stroom}
Tab
Tab links are similar to dialog links are used to embed any referenced URL in a Stroom tab.
Tab links look something like this in HTML:
<div style="padding: 5px;">
<span style="text-decoration:underline;color:blue;cursor:pointer"
link="[Show](https://www.somehost.com/somepath){tab|Embedded In Stroom}">
Show In Stroom Tab
</span>
</div>
Note
The tab title can be controlled by adding a | and required title after the type, e.g.
{tab|Embedded In Stroom}
Browser
Browser links are used to open any referenced URL in a new browser tab.
In most cases this is easily accomplished via a normal hyperlink but Stroom also provides a mechanism to do this as a link event so that dashboard tables are also able to open new browser tabs.
This can be accomplished by using the link() table function.
In a dashboard text pane the HTML could look like this:
<div style="padding: 5px;">
<span style="text-decoration:underline;color:blue;cursor:pointer"
link="[Show](https://www.somehost.com/somepath){browser}">
Show In Browser Tab
</span>
</div>
Note
Unlike the other link types there is no way to control the browser tab title.
Dashboard
In addition to viewing/embedding external URLs, Stroom links can be used to direct Stroom to show an internal item or feature.
The dashboard link type allows Stroom to open a new tab and show a dashboard with the specified parameters.
By using a pipeline with the appropriate XSLT it is possible to dynamically generate links in dashboard text panes that will be specific to the data being displayed.
Data
A link can be created to open a sub-set of a source of data (i.e. part of a stream) for viewing.
The data can either be opened in a popup dialog (dialog) or in another stroom tab (tab).
It can also be display in preview form (with formatting and syntax highlighting) or unaltered source form.
Note
To make full use of data links for viewing raw data, you need to use the stroom:source()stroom:source()
Returns an XML document in the stroom-meta namespace describing the current source location.
Click to see more details… to decorate an event with the details of the source location it derived from.
Stroom deals in two main types of stream, segmented and non-segmented (see Streams).
Data in a non-segmented (i.e. raw) stream is identified by an id, a partNo and optionally line and column positions to define the sub-set of that stream part to display.
Data in a segmented (i.e. cooked) stream is identified by an id, a recordNo and optionally line and column positions to define the sub-set of that record (i.e. event) within that stream.
The parameters for data links are:
id - The stream ID.
partNo - The part number of the stream (one based).
Always 1 for segmented (cooked) streams.
recordNo - The record number within a segmented stream (optional).
Not applicable for non-segmented streams so use null() instead.
lineFrom - The line number of the start of the sub-set of data (optional, one based).
colFrom - The column number of the start of the sub-set of data (optional, one based).
lineTo - The line number of the end of the sub-set of data (optional, one based).
colTo - The column number of the end of the sub-set of data (optional, one based).
viewType - The type of view of the data (optional, defaults to preview):
preview : Display the data as a formatted preview of a limited portion of the data.
source : Display the un-formatted data in its original form with the ability to navigate around all of the data source.
displayType - The way of displaying the data (optional, defaults to dialog):
dialog : Open as a modal popup dialog.
tab : Open as a top level tab within the Stroom browser tab.
In preview mode the line and column positions will limit the data displayed to the specified selection.
In source mode the line and column positions define a highlight block of text within the part/record.
Warning
The displayType value tab is not supported if the dashboard is viewed via a Direct URL.
This is because a direct URL displays only the dashboard without Stroom's top level tab bar so it is not possible to open it as a top level tab.
An example of this type of link in HTML:
<div style="padding: 5px;">
<span style="text-decoration:underline;color:blue;cursor:pointer"
link="[link](id=1822&partNo=1&recordNo=1){data}">
Show Source</span>
</div>
View Type
The additional parameter viewType can be used to switch the data view mode from preview (default) to source.
In preview mode the optional parameters lineFrom, colFrom, lineTo, colTo can be used to limit the portion of the data that is displayed.
A link can be used to edit or create annotations.
To view or edit an existing annotation the id must be known or one can be found using a stream and event id.
If all parameters are specified an annotation will either be created or edited depending on whether it exists or not.
The format for an annotation link is as follows:
The parameters for annotation links are as follows:
annotationId - The optional existing id of an annotation if one already exists.
streamId - An optional stream id to link to a newly created annotation, or used to lookup an existing annotation if no annotation id is provided.
eventId - An optional event id to link to a newly created annotation, or used to lookup an existing annotation if no annotation id is provided.
title - An optional default title to give the annotation if a new one is created.
subject - An optional default subject to give the annotation if a new one is created.
status - An optional default status to give the annotation if a new one is created.
assignedTo - An optional initial assignedTo value to give the annotation if a new one is created.
comment - An optional initial comment to give the annotation if a new one is created.
2.3 - Direct URLs
Navigating directly to a specific Stroom dashboard using a direct URL.
It is possible to navigate directly to a specific Stroom dashboard using a direct URL.
This can be useful when you have a dashboard that needs to be viewed by users that would otherwise not be using the Stroom user interface.
The host and path are typically https://<HOST>/stroom/dashboard where <HOST> is the hostname/IP for Stroom.
type
type is a required parameter and must always be Dashboard since we are opening a dashboard.
uuid
uuid is a required parameter where <DASHBOARD UUID> is the UUID for the dashboard you want a direct URL to, e.g. uuid=c7c6b03c-5d47-4b8b-b84e-e4dfc6c84a09
The UUID for the dashboard that you want to link to can be found by right clicking on the dashboard icon in the explorer tree and selecting Info.
The Info dialog will display something like this and the UUID can be copied from it:
DB ID: 4
UUID: c7c6b03c-5d47-4b8b-b84e-e4dfc6c84a09
Type: Dashboard
Name: Stroom Family App Events Dashboard
Created By: INTERNAL
Created On: 2018-12-10T06:33:03.275Z
Updated By: admin
Updated On: 2018-12-10T07:47:06.841Z
title (Optional)
title is an optional URL parameter where <DASHBOARD TITLE> allows the specification of a specific title for the opened dashboard instead of the default dashboard name.
The inclusion of ${name} in the title allows the default dashboard name to be used and appended with other values, e.g. 'title=${name}%20-%20' + param.name
params (Optional)
params is an optional URL parameter where <DASHBOARD PARAMETERS> includes any parameters that have been defined for the dashboard in any of the expressions, e.g. params=userId%3DFred%20Bloggs
Permissions
In order for a user to view a dashboard they will need the necessary permission on the various entities that make up the dashboard.
For a Lucene index query and associated table the following permissions will be required:
Read permission on the Dashboard entity.
Use permission on any Index entities being queried in the dashboard.
Use permission on any Pipeline entities set as search extraction Pipelines in any of the dashboard’s tables.
Use permission on any XSLT entities used by the above search extraction Pipeline entities.
Use permission on any ancestor pipelines of any of the above search extraction Pipeline entities (if applicable).
Use permission on any Feed entities that you want the user to be able to see data for.
For a SQL Statistics query and associated table the following permissions will be required:
Read permission on the Dashboard entity.
Use permission on the StatisticStore entity being queried.
For a visualisation the following permissions will be required:
Read permission on any Visualisation entities used in the dashboard.
Read permission on any Script entities used by the above Visualisation entities.
Read permission on any Script entities used by the above Script entities.
3 - Query
A Query document defines a search query in text form using the Stroom Query Language and displays the results as a table or a visualisation.
TODO
Complete this section.
3.1 - Stroom Query Language
Stroom Query Language (StroomQL) is a query language for retrieving data in Stroom.
Query Format
Stroom Query Language (StroomQL) is a text based replacement for the existing DashboardDashboard
A Dashboard is a configurable entity for querying one or more Data Sources and displaying the results as a table, a visualisation or some other form.
Click to see more details... query builder and allows you to express the same queries in text form as well as providing additional functionality.
It is currently used on the Query entity as the means of defining a query.
The following shows the supported syntax for a StroomQL query.
Fields are the fields in a data source.
Fields are case-sensitive.
If the field name contains white space then it must be surround by braces and preceded by a dollar sign, e.g ${Create Time}.
If the field name does not contain spaces it can be written with or without the braces, e.g. Status or ${Status}.
Fields can added to the query text in one of three ways:
Directly typing the field name (with braces as required).
Double clicking the field name in the Field picker in the left hand pane.
Field names with spaces will be pasted in with braces.
Using code completion.
In the query editor hit
Ctrl ^+Space ␣
to bring up a list of context aware completion terms, e.g. field names, then hit tab to insert it.
You could also type a few characters from the name before hitting
Ctrl ^+Space ␣
to pre-filter the list.
Field names with spaces will be pasted in with braces.
Keywords
Keywords are the reserved words that define the structure of the query, e.g. from, select, where.
Unlike fields, they are case-insensitive.
From
The first part of a StroomQL expression is the from clause that defines the single data source to query.
All queries must include the from clause.
Select the data source to query, e.g.
from my_source
If the name of the data source contains white space then it must be quoted using " double quotes, e.g.
from "my source"
Where
Use where to construct query criteria, e.g.
where feed = "my feed"
Add boolean logic with and, or and not to build complex criteria, e.g.
where feed = "my feed"
or feed = "other feed"
Use brackets to group logical sub expressions, e.g.
where user = "bob"
and (feed = "my feed" or feed = "other feed")
Conditions
Supported conditions are:
= - Equals.
!= - Not equals.
> - Greater than.
>= - Greater than or equal to.
< - Less than.
<= - Less than or equal to.
is null - The value is null.
is not null - The value is not null.
in - The value is in a list of allowed values.
e.g. StreamId in (1001, 1002, 2009)
or Feed in ("FEED_X", "FEED_Y").
in dictionary - The value is in a list of allowed values that are contained in a
Dictionary
.
e.g. Feed in dictionary "My Dict" (using the dictionary’s unique name)
or Feed in dictionary "fb7a8cea-e6b4-4d94-8f7e-47ff3b3c7711" (using the dictionary’s UUIDUUID
A Universally Unique Identifier for uniquely identifying something. UUIDs are used as the identifier in Doc Refs. An example of a UUID is 4ffeb895-53c9-40d6-bf33-3ef025401ad3.
Click to see more details...).
And|Or|Not
Logical operators to add to where and filter clauses.
Bracket Groups
You can force evaluation of items in a specific order using bracketed groups.
and X = 5 OR (name = foo and surname = bar)
Window
window <TIME_FIELD> by <WINDOW_SIZE> [advance <ADVANCE_WINDOW_SIZE>]
Windowing groups data by a specified window size applied to a time field.
A window inserts additional rows for future periods so that rows for future periods contain count columns for previous periods.
Specify the field to window by and a duration.
Durations are specified in simple terms e.g. 1d, 2w etc.
By default, a window will insert a count into the next period row.
This is because by default we advance by the specified window size.
If you wish to advance by a different duration you can specify the advance amount which will insert counts into multiple future rows.
Filter
Use filter to filter values that have not been indexed during search retrieval.
This is used the same way as the where clause but applies to data after being retrieved from the index, e.g.
filter obscure_field = "some value"
Add boolean logic with and, or and not to build complex criteria as supported by the where clause.
Use brackets to group logical sub expressions as supported by the where clause.
Note
As filters do not make use of the index they can be considerably slower than a where clause, however they allow filtering on fields that have not been indexed for some reason.
Frequent use of filter on a field suggests you may want to consider including that field in an index.
Eval
Use eval to assign the value returned from an Expression Function to a named variable, e.g.
eval my_count = count()
Here the result of the count() function is being stored in a variable called my_count.
Functions can be nested and applied to variables, e.g.
In this example, the second assignment of new_name will override the value initially assigned to it.
Note that when reusing a variable name, the assignment can depend on the previous value assigned to that variable.
Add boolean logic with and, or and not to build complex criteria, e.g.
where feed = "my feed" or feed = "other feed"
Use brackets to group logical sub expressions, e.g.
where user = "bob" and (feed = "my feed" or feed = "other feed")
Having
A post aggregate filter that is applied at query time to return only rows that match the having conditions.
having count > 3
Group By
Use to group by columns, e.g.
group by feed
You can group across multiple columns, e.g.
group by feed, name
You can create nested groups, e.g.
group by feed
group by name
Sort By
Use to sort by columns, e.g.
sort by feed
You can sort across multiple columns, e.g.
sort by feed, name
You can change the sort direction, e.g.
sort by feed asc
Or
sort by feed desc
Limit
Limit the number of results, e.g.
limit 10
Select
The select keyword is used to define the fields that will be selected out of the data source (and any eval’d fields) for display in the table output.
select feed, name
You can optionally rename the fields so that they appear in the table with more human friendly names.
select feed as 'my feed column',
name as 'my name column'
Show
The show keyword is used to tell StroomQL how to show the data resulting from the select.
A Stroom visualisation can be specified and then passed column values from the select for the visualisation control properties.
show LineChart(x = EventTime, y = count)
show Doughnut(names = Feed, values = count)
For visualisations that contain spaces in their names it is necessary to use quotes, e.g.
show "My Visualisation" (x = EventTime, y = count)
Comments
Single Line
StroomQL supports single line comments using //.
For example:
from "index_view" // view
where EventTime > now() - 1227d
// and StreamId = 1210
select StreamId as "Stream Id", EventTime as "Event Time"
Multi Line
Multiple lines can be commented by surrounding sections with /* and */.
For example:
from "index_view" // view
where EventTime > now() - 1227d
/*
eval FirstName = lowerCase(substringBefore(UserId, '.'))
eval FirstName = any(FirstName)
*/
select StreamId as "Stream Id", EventTime as "Event Time"
Examples
The following are various example queries.
// add a where
from "index_view" // view
where EventTime > now() - 1227d
// and StreamId = 1210
eval UserId = any(upperCase(UserId))
eval FirstName = lowerCase(substringBefore(UserId, '.'))
eval FirstName = any(FirstName)
eval Sl = stringLength(FirstName)
eval count = count()
group by StreamId
sort by Sl desc
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count
limit 10
from "index_view" // view
// add a where
where EventTime > now() - 1227d
// and StreamId = 1210
eval UserId = any(upperCase(UserId))
eval FirstName = lowerCase(substringBefore(UserId, '.'))
eval FirstName = any(FirstName)
eval Sl = stringLength(FirstName)
eval count = count()
group by StreamId
sort by Sl desc
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count
limit 10
from "index_view" // view
// add a where
where EventTime > now() - 1227d
// and StreamId = 1210
eval UserId = any(upperCase(UserId))
eval FirstName = lowerCase(substringBefore(UserId, '.'))
eval FirstName = any(FirstName)
eval Sl = stringLength(FirstName)
// eval count = count()
// group by StreamId
// sort by Sl desc
select StreamId as "Stream Id", EventId as "Event Id"
// limit 10
from "index_view" // view
// add a where
where EventTime > now() - 1227d
// and StreamId = 1210
eval UserId = any(upperCase(UserId))
eval FirstName = lowerCase(substringBefore(UserId, '.'))
eval FirstName = any(FirstName)
eval Sl = stringLength(FirstName)
eval count = count()
group by StreamId
sort by Sl desc
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count
limit 10
Help Pane
The left hand pane of the Query editor provides help for building a StroomQL query.
It contains the following items:
Data Sources - The list of data sources (visible to the user) that can be queried.
Structure - The list of keywords available to use, e.g. select.
Annotation Fields - The list of special fields for accessing data from Annotations linked to the data being queried.
The fields list will only be available once a complete from ... clause has been added that uses a data source that supports Annotations, e.g. an Index.
Fields - The list of fields that can be used in the Query.
The fields list will only be available once a complete from ... clause has been added.
Clicking on an item will show some detailed help about that item in the bottom of the pane.
Double clicking on the item will insert it into the query editor.
It will be inserted with double quotes or braces as appropriate to the item being inserted.
Code Completion
The StroomQL editor benefits from code completion to speed up the writing of queries.
Pressing
Ctrl ^,Space ␣
in the query editor will bring up a context aware context menu listing items that can be inserted into the query, e.g. fields, functions, keywords, dictionaries, data sources, etc.
If you type some letters of the item you want, e.g. sub then
Ctrl ^,Space ␣
, it will bring up a list of items that contain the letters sub in that order, e.g. substring(..), isDouble(..), etc.
You can either use the cursor keys to scroll up/down the list or continue typing letters to further refine the filtering of the list.
Hit
Enter ↵
or
Tab ↹
to insert the item into the editor.
The context menu also shows some more detailed help, e.g. to describe the argument to functions.
Functions
Expression Functions are inserted with tab stops to enable fast population of the function arguments.
For example:
Type sub then hit
Ctrl ^,Space ␣
.
Select substring(..) from the list and hit
Tab ↹
. substring(input, startIndex, endIndex) is inserted, with input highlighted.
Type Feed to replace input with Feed, then hit
Tab ↹
. substring(Feed, startIndex, endIndex) is displayed, with startIndex highlighted.
Type 0 to replace startIndex with 0, then hit
Tab ↹
. substring(Feed, 0, endIndex) is displayed, with endIndex highlighted.
Type 5 to replace endIndex with 5, then hit
Tab ↹
. substring(Feed, 0, 5) is displayed, with the cursor now positioned after the closing bracket.
4 - Analytic Rules
Analytic Rules are queries that can be run against the data either as it is ingested or on a scheduled basis.
An Analytic Rule runs a query over your data and turns each row the query returns into a detection.
Detections are then delivered to one or more destinations, either written to a FeedFeed
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... as XML or sent to people by email.
A rule is the combination of four things, each of which has its own tab on the rule.
The query that decides what counts as a detection.
The processing type, which decides when and how the query is run.
The execution settings, which for a scheduled rule decide when it runs and over what period.
The notifications, which decide where detections are delivered.
If you want to run a query on a schedule and send the results to someone as a file rather than as detections, use a Report instead.
Reports and Analytic Rules share most of their configuration, so much of this section applies to both.
Processing Types
The Processing Type is set on the rule’s Execution tab and decides how the query is run.
It is the most significant choice you make about a rule, because it determines what the rest of the rule’s configuration means.
Processing Type
When the query runs
Typical use
Scheduled Query
On a schedule that you define, over a window of data.
A Stream is the unit of data that Stroom works with and will typically contain many Events.
Click to see more details... as it is processed.
Rules that must alert as close to ingest as possible.
Table Builder
Experimental, see below.
Not for production use.
Changing the processing type changes which tabs the rule shows, because some settings only apply to one type.
Note
Whichever processing type you choose, the rule does nothing until the corresponding background job is enabled.
These jobs are all disabled by default, see Jobs below.
Scheduled Query
A Scheduled Query rule runs its query on a schedule, for example every hour or at 03:00 each day.
Each run covers a window of data, and the rule keeps track of which windows it has already covered so that it can work through history without gaps or repeats.
This is the type to use for most rules.
It is also the only type available to Reports.
A Processor Filter is used to used to find Streams to process through the Pipeline associated with the Processor Filter. A Processor Filter consists of an expression tree to select which Streams to process and a tracker to track the what Streams have been processed.
Click to see more details..., in the same way as a translation pipeline.
Each stream that matches the filter is passed through the rule as it is processed, so detections are raised without waiting for a schedule to come round.
Markdown is a simple markup language for creating rich formatted text using a text editor. Due to the simplicity of the Markdown it is still very readable in its raw form that contains the markup. Markdown is used in Stroom on the Documentation tab of each Document type and in the DocumentationDocument type.
Click to see more details... describing the rule.
Permissions
All
Who can read and use the rule.
The content of the Documentation tab is not just for readers.
It is also used as the detailedDescription of the detections the rule raises, so it is worth writing something that will make sense to whoever receives the detection.
This can be turned off per rule with Include Rule Documentation on the Settings tab.
Jobs
Analytic Rules are run by background jobs, all of which are disabled by default.
A newly created rule will do nothing at all until the job for its processing type has been enabled in
Monitoring
Jobs
.
Job
Drives
Analytic Executor: Scheduled Query
Scheduled Query rules.
Analytic Executor: Table Builder
Table Builder rules.
Analytic Execution History Retention
Deletion of old execution history.
Streaming rules are run by the normal stream processing jobs rather than by a job of their own.
The job frequency controls how often Stroom looks for schedules that are due, not how often a rule runs.
A rule scheduled to run every ten minutes will not do so if the job that looks for due schedules only runs hourly.
StroomQuery Language is Stroom’s own query language. It has similarities with Structured Query Language (SQL) as used in databases. StroomQL is sometimes referred to as sQL to distinguish it from SQL.
Click to see more details... query that defines the rule.
It is the same query editor used by the Query document, so you can write a query, run it and inspect the results while you are developing the rule.
Every row the query returns becomes one detection.
This is the single most important thing to understand about a rule.
A query that returns a million rows will raise a million detections, so it is worth running the query and looking at the row count before enabling the rule.
A rule query can use any data source that a Query document can use, but the choice interacts with the processing type.
A Scheduled Query rule can query anything, including SearchablesSearchable
A Searchable is the term given the special searchable data sources that appear at the root of the explorer tree picker when selecting a data source. These data sources are special internal data sources that are not user managed content, unlike an Index. They provide the means to search various aspects of Stroom’s internals, such as the Meta Store or Processor Tasks.
Click to see more details... and Lucene indexes.
A Streaming rule must query a View , because the View’s filter is what decides which streams are fed through the rule.
A rule that is going to run repeatedly should express its time range relative to when it runs, not as absolute dates.
When a scheduled rule runs, Stroom sets the reference time for the query to the rule’s effective execution time rather than to the current clock time.
Every relative date expression in the query and in the time range is then resolved against that effective time.
This is what makes it possible for a rule to work through history.
A rule whose query says where EventTime >= day() - 1d will, when it runs for an effective time of last Tuesday, select last Monday’s data.
The same query run for an effective time of today selects yesterday’s data.
Note
The effective execution time is not the same as the wall clock time at which the rule ran.
The difference matters whenever a rule is catching up, being replayed, or running over a historic period.
Both times are recorded on every detection, as effectiveExecutionTime and executionTime.
The columns your query selects become the content of each detection.
Every column is added to the detection as a name/value pair, using the column’s name as the key, and is available to email templates through the values dictionary.
Two column names are treated specially.
Column
Treatment
StreamId
Used as the streamId of the detection’s linked event rather than added to values.
EventId
Used as the eventId of the detection’s linked event rather than added to values.
Including StreamId and EventId in the query is what allows a detection to link back to the EventEvent
An event is a single auditable event, e.g. a user logging in to a system. A Stream typically contains multiple events.
Click to see more details... that caused it.
Without them the detection still carries all its other values, but there is nothing to click through to.
Warning
Column names become keys in the email template context, so it pays to choose names that are easy to reference.
A column named Source IP has to be written as values['Source IP'] in a template, whereas SourceIp can be written as values.SourceIp.
Some things about a result table cannot be expressed in StroomQlStroomQl
StroomQuery Language is Stroom’s own query language. It has similarities with Structured Query Language (SQL) as used in databases. StroomQL is sometimes referred to as sQL to distinguish it from SQL.
Click to see more details..., such as which columns are hidden, how values are formatted and how rows are sorted.
These are set by interacting with the results table in the UI and are stored on the rule alongside the query.
For an Analytic Rule these preferences affect only what you see while developing the query.
For a Report they also affect the file that is produced, because the report is written from the same table.
Parameters
A rule can define parameters in the same way as a Query document, and refer to them in the query.
Parameters are stored on the rule, so a scheduled rule always runs with the values held against it.
4.2 - Rule Settings
What a rule declares about itself, whether its documentation is included in detections, and where its errors go.
The Settings tab holds the settings that describe the rule itself, rather than its query, its schedule or the notifications it sends.
Level and Status
Field
Description
Level
The severity of the rule.
Status
How reliable the rule is.
Neither is mandatory.
A rule that sets neither produces detections without them, which is how every rule created before these settings existed behaves.
Both are written to every detection the rule produces, whatever its processing type, and both are available to notification email templates as {{ level }} and {{ status }}.
Level describes how urgent a detection from this rule is, so that whoever receives it can prioritise.
Level
Meaning
Low
Little urgency. Worth recording, but not worth interrupting anyone for.
Medium
Ordinary priority.
High
Should be looked at ahead of lower level detections.
Critical
The most urgent. Reserve it, or it stops meaning anything.
Status describes how much the rule can be trusted, which tells an analyst how much weight to give a detection and how many false positives to expect.
Status
Meaning
Experimental
An early-stage rule that may be incomplete. Expect more false positives.
Testing
More mature than an experimental rule. Actively being validated in real environments. Expect some false positives.
Stable
Considered production-ready. Has been thoroughly tested across multiple environments. Expect a reasonable false positive rate.
Deprecated
An outdated or superseded rule that may rely on old techniques or assumptions. Generally avoid using these in production.
Note
Level and Status describe the rule, not the individual detection, so every detection a rule produces carries the same values.
Raising the level of a rule affects only the detections it produces from that point on.
Include Rule Documentation
Field
Description
Include Rule Documentation
Whether the rule’s documentation is included in the detections it produces.
The content of the rule’s Documentation tab is written to each detection as detailedDescription, which means it leaves Stroom with the detection, for example by email.
Untick this where the documentation is for whoever maintains the rule rather than for whoever receives its detections.
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... that errors occurring during execution are written to. Use Set Default to use the feed configured for the system.
Execution schedules, how a scheduled rule works through time, and the history of what it has run.
The Execution tab sets the rule’s processing type, and for a Scheduled Query rule it is where you define when the rule runs.
A scheduled rule does not have a single schedule field.
Instead it has a list of execution schedules, each of which runs the rule independently.
The tab is split, with the schedules in the upper pane and the history of what those schedules have done in the lower one.
Everything on this page applies equally to Reports, which use the same execution machinery.
Execution Schedules
Use the button above the schedule list to add a schedule.
Field
Description
Name
A name for this schedule, used to identify it in the history and recorded on every detection it raises.
Enabled
Whether this schedule runs. A schedule that is not enabled is ignored.
Processing Node
The node that will run the rule. Use Set Default to use the node configured for the system.
Cron is a command line utility found on most linux/unix systems that is used for scheduling background tasks. Cron expressions (or variants of them) are widely used in other schedulers.
Click to see more details... expression saying how often the rule runs.
Start Time
The effective time of the first run, see How Time Works.
End Time
An optional effective time after which the schedule stops running.
Refers to a Stroom User that is linked to either an Account in Stroom’s internal Identity Provider or a user account in an external Identity Provider. A Stroom User is primarily concerned with authorisation (i.e. application/document permissions and group memberships) rather than authentication, though disabling one also refuses that person at authentication and ends any access they currently hold.
Click to see more details... whose permissions the query runs with.
Having more than one schedule on a rule is useful when you want the same query run over different periods.
A common pattern is a frequent schedule that keeps up with new data, plus a second schedule with a start and end time that is used once to work back over history.
Run as User
The query runs with the permissions of the Run As User, not those of whoever created the rule.
If that user cannot see some of the data, the rule will silently detect nothing in it.
Note
Changing what a user can see changes what the rules running as that user will detect.
Stroom records these dependencies so that a user cannot be deleted while schedules still run as them.
How Time Works
Each run of a schedule has two different times associated with it, and telling them apart is the key to understanding scheduled rules.
Time
Meaning
Execution Time
The wall clock time at which the rule actually ran.
Effective Execution Time
The point in time the run represents. This is what relative date expressions in the query resolve against.
For a rule that is keeping up with new data the two are almost the same.
They diverge whenever a rule is catching up, because a rule that is behind will run now for an effective time in the past.
The effective time of the first run comes from the schedule’s Start Time, or from the next occurrence of the schedule if no start time is set.
After each successful run Stroom records where it has got to, and the next run picks up from there.
Contiguous Execution
Whether a schedule catches up or skips ahead is decided by whether it is contiguous.
A contiguous schedule takes its next effective time from the last effective time.
If the rule has not run for a week, it will work forward through that week one run at a time until it catches up.
No window of data is missed.
A non-contiguous schedule takes its next effective time from the current time.
If the rule has not run for a week, that week is skipped.
Contiguous execution is what you want for a rule that must not miss anything.
Be aware that it means a rule which has been disabled for a long time, or whose start time is set well in the past, will have a lot of catching up to do when it is enabled.
Replaying an Execution
Selecting a row in the execution history and clicking Replay Execution sets up a re-run of that one execution.
Replaying does not run anything immediately.
It adds a new execution schedule, named after the original with (replay) appended, whose start and end times are both the effective execution time of the row you selected.
The new schedule is created disabled, so nothing happens until you enable it.
This is deliberate, as it gives you the chance to check the bounds before the rule runs again.
Once enabled, the schedule runs the rule once for that effective time and then has nothing further to do.
Replay works on a single history row at a time.
To re-run a range of executions, add an ordinary schedule with the start and end times you want instead.
Warning
Re-running an execution will raise its detections again.
Where this is not what you want, use Duplicate Management to suppress the repeats.
Execution History
The lower pane lists what each schedule has done.
Column
Description
Execution Time
When the run happened.
Effective Execution Time
The point in time the run represents.
Status
Complete or Error.
Message
The error message where the run failed.
History is kept for the period set by the stroom.analytics.executionHistoryRetention property and is deleted by the Analytic Execution History Retention job.
Warning
A schedule that fails is disabled.
When a run fails with an error, Stroom disables that execution schedule rather than letting it fail repeatedly.
The rule then stops running, and stays stopped until someone notices and re-enables it.
This is the most common reason for a rule that appears to have quietly stopped working.
Check the Enabled state of the schedule and the last row of the execution history, then look at the rule's error feed for the detail.
The Execution Schedule Manager
The rule’s Execution tab only shows that rule’s schedules.
Monitoring
Execution Schedule Manager
shows every execution schedule in the system, for Analytic Rules and Reports alike, and is where bulk operations live.
The list identifies each schedule by the document it belongs to as well as by its own name, and can be filtered.
Button
Purpose
Edit Selected Schedule
Edit one schedule, as on the rule itself.
Batch Edit Schedules
Change the name, enabled state, processing node, schedule, bounds or run as user of many schedules at once.
Filter Schedules
Narrow the list, for example to one document or one node.
Run Schedules Now
Force schedules to run without waiting for them to fall due.
Delete Schedules
Delete the selected schedules.
Run Schedules Now and Batch Edit Schedules can be applied either to the schedules you have selected or to everything matching the current filter.
Warning
Run Schedules Now does not run a schedule once.
It forces the selected schedules to process until they are up to date, which for a contiguous schedule that is well behind means working through every window between where it had got to and now.
This can take a long time and raise a great many detections, so check what is selected before confirming.
Disabled schedules are not run, and Stroom warns you when the selection contains any.
Error Feed
Errors raised while a rule is running are written as Error streams to the rule’s error feed.
The feed is set by Feed For Errors on the Settings tab rather than on this one.
Where the rule does not name one, the feed configured in stroom.ui.analyticUiDefaultConfig.defaultErrorFeed is used, and a run for which neither is set fails.
A run can fail before there is anywhere to write to, for example when neither the rule nor the system configuration names an error feed.
Failures of that kind are recorded against the execution history instead, which is why it is worth looking at both.
4.4 - Rule Notifications
Delivering detections to a feed or to people by email, and limiting how many notifications a rule can send.
The Notifications tab decides what happens to the detections a rule raises.
Settings that describe the rule as a whole, such as what its detections contain, are on the Settings tab instead.
The tab is a list of notifications.
A rule can have any number of notifications and each one is delivered independently.
A rule that both writes detections to a feed for later analysis and emails a few people about them has two notifications, not one.
Column
Description
Enabled
Whether this notification is delivered.
Type
Stream or Email.
Destination
The feed or email address that detections go to.
Limit
Whether the number of notifications is limited.
Max
The limit, where one is set.
Note
A rule with no notifications at all will fail when it runs, because there is nowhere for its detections to go.
Everything on this page applies to Reports as well, except that a report delivers a file rather than a detection.
The differences are covered in Report Delivery.
Stream Destinations
A Stream notification writes detections into a FeedFeed
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... as XML conforming to the detection:1XML SchemaXML Schema
XML Schema is a language used to define the permitted structure of an XML document. An XML Schema can be used to validate an XML document to ensure it conforms to that schema such that onward processing of the XML document can be done with confidence that the document is correct.
Click to see more details....
This is the right choice when detections are themselves data, to be indexed, searched, or fed into another rule.
Field
Description
Destination Feed
The feed the detections are written to. Use Set Default to use the feed configured for the system.
Use Source Feed If Possible
Writes detections to the feed the source data came from rather than to the destination feed.
Use Source Feed If Possible is useful for a streaming rule that runs across many feeds and whose detections are best kept alongside the data that produced them.
Note
The option only applies to streaming rules, and is disabled for any other processing type.
A scheduled rule looks across many streams and so has no single source feed to write back to, and a rule that is not streaming always uses the Destination Feed.
An Email notification sends each detection to people as an email.
Field
Description
To
Recipient addresses.
Cc
Addresses to copy.
Bcc
Addresses to copy without other recipients seeing.
Email Subject Template
A template for the subject line.
Email Body Template
A template for the body.
Each field accepts more than one address.
Note
Email will not work until an SMTP server has been configured for the installation.
The from address and name also come from that configuration rather than from the rule.
See Email Setup.
Templates
The subject and body are Jinja templates rather than fixed text, so that each email can describe the detection that triggered it.
The values from the detection are put into the template context before the template is rendered, so {{ detectTime }} renders when the detection happened and values.SourceIp renders the value of the query’s SourceIp column.
If the rendered body looks like HTML it is sent as an HTML email, otherwise it is sent as plain text.
Two buttons let you check a template without waiting for a real detection.
Test Template renders the template against an example detection and shows you the result, including any errors in the template.
Send Test Email sends that example detection to the configured recipients, which also proves the SMTP configuration works.
Limiting Notifications
A rule that suddenly matches far more data than expected can send a very large number of emails.
The limit settings exist to bound that.
Field
Description
Limit Notifications
Whether a limit applies.
Maximum Notifications
How many notifications may be sent before this one stops.
Resume Notifications After
How long to wait before allowing notifications again.
Once Maximum Notifications have been sent the notification switches itself off and nothing further is delivered through it.
It comes back on when Resume Notifications After has elapsed since the last notification was sent, at which point the count starts again from zero.
Warning
Detections suppressed by a limit are discarded, not queued.
A rule that hits its limit will not deliver the detections it raised while switched off, even after it resumes.
Where the aim is to avoid being told the same thing repeatedly rather than to bound the volume, Duplicate Management is usually the better tool, because it suppresses repeats of a detection you have already seen while still delivering new ones.
The count is held per notification and is not persisted, so restarting the node resets it.
4.5 - Detections
What a detection contains, how it is built from the rule’s query, and the XML written to a feed.
A detection is what an Analytic Rule produces.
One is raised for each row the rule’s query returns, and it is the detection, rather than the row, that is delivered to the rule’s notifications.
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... are XML in the detection:1 namespace, so they can be indexed and searched like any other data in Stroom.
Detections sent by email are rendered through a template that has access to the same fields.
Warning
A rule's detections do not currently validate against the published detection:1XML SchemaXML Schema
XML Schema is a language used to define the permitted structure of an XML document. An XML Schema can be used to validate an XML document to ensure it conforms to that schema such that onward processing of the XML document can be done with confidence that the document is correct.
Click to see more details… in the core content pack.
Stroom writes detectorUuid, executionSchedule, executionTime, effectiveExecutionTime, level, status and feedName, none of which that schema declares, and the schema requires a headline element that a rule does not produce.
This affects validation only, for example an XML Schema filter in a pipeline.
Indexing, searching and delivery are unaffected.
How a Detection is Built
Most of a detection is filled in for you from the rule and from the run that raised it.
A Universally Unique Identifier for uniquely identifying something. UUIDs are used as the identifier in Doc Refs. An example of a UUID is 4ffeb895-53c9-40d6-bf33-3ef025401ad3.
Click to see more details... of the rule document.
detectorVersion
The version of the rule document at the time it ran.
detailedDescription
The content of the rule’s Documentation tab, see below.
A Universally Unique Identifier for uniquely identifying something. UUIDs are used as the identifier in Doc Refs. An example of a UUID is 4ffeb895-53c9-40d6-bf33-3ef025401ad3.
Click to see more details..., different for every detection.
Built from the StreamId and EventId columns, see below.
level
The severity declared by the rule, where it declares one, see Settings.
status
How reliable the rule declares itself to be, where it declares it, see Settings.
Because detailedDescription comes from the rule’s documentation, what you write there is delivered with the detections the rule raises.
It is worth writing it for whoever receives the detection rather than for whoever maintains the rule.
Whether it is included is controlled by Include Rule Documentation on the Settings tab, which applies to every processing type.
Where it is unticked, detailedDescription is left empty.
Note
detectorVersion is the version of the rule document, which changes every time the rule is saved.
It is not a version you set yourself.
Values
Every column the query selects becomes an entry in values, keyed by the column name.
In a feed these appear as <value name="..."> elements, and in an email template they are reachable through the values dictionary.
The two exceptions are StreamId and EventId.
Rather than appearing in values, they are used to build a linked event, which records the StreamStream
A Stream is the unit of data that Stroom works with and will typically contain many Events.
The detection:1 schema has several fields that an Analytic Rule never populates, because they only make sense for a detector that revises its own findings over time.
Field
Purpose
headline
A short description of what was detected.
fullDescription
A complete description of what was detected.
detectorEnvironment
Where the detector was deployed.
defunct
Marks earlier revisions of a detection as invalid.
These exist because the same schema is used by detections produced outside Stroom, for example by an XSLT in a translation pipeline or by an external processing framework, which can set them.
Writing detections to a feed means they can be treated as data in their own right.
Once indexed they can be searched from a Dashboard or Query, reported on, and used as the input to further rules.
A rule whose query runs over a feed of detections is a common way of spotting a pattern across detections that no single detection shows on its own.
4.6 - Duplicate Management
Suppressing detections that repeat something you have already been told.
Some rules will detect the same thing over and over.
A rule that runs hourly and looks for a misconfigured device will find that device every hour until someone fixes it, and nobody needs telling twenty four times a day.
Duplicate Management suppresses detections that match ones the rule has already raised.
The tab is only shown for Scheduled Query rules.
This is different from limiting notifications, which bounds how many notifications a rule may send regardless of what they say.
Duplicate management suppresses repeats while still delivering anything new.
Settings
Field
Description
Remember Notifications
Store the column values of de-duplicated detections so they can be viewed.
Suppress Duplicate Notifications
Suppress detections identical to ones already sent.
Choose Columns
Use a chosen set of columns to decide what counts as identical, rather than all of them.
Columns
A comma delimited list of column names, used when Choose Columns is set.
The two switches are independent, and the store is used if either of them is set.
Remember
Suppress
Effect
No
No
No store is used at all, and every detection is delivered.
No
Yes
Duplicates are suppressed.
Yes
No
Every detection is delivered, but what the rule has seen is recorded so it can be viewed.
Yes
Yes
Duplicates are suppressed, and what the rule has seen can be viewed.
Setting Remember Notifications on its own is a useful way to see what a rule would suppress before committing to suppressing it.
The lower part of the tab lists what the rule has stored, which is how you check why something was or was not suppressed.
It also lets you clear the store.
Choosing Columns
Where Choose Columns is not set, the columns used depend on whether the query groups its results.
A query with grouped columns uses those grouped columns, and ignores the rest.
A query with no grouping uses every column.
Using every column is often too strict, because a column that changes on every run will make every detection unique.
A rule whose query selects a timestamp, or a count, or an event id, will never suppress anything unless the columns are narrowed down to the ones that identify the thing being detected.
Choose Columns is how you narrow them.
For the misconfigured device example, choosing just the device name means the rule tells you about that device once rather than hourly, however much the other columns change.
Column names are case sensitive and must match the names in the query.
Warning
Changing which columns are used for de-duplication requires the duplicate check store to be cleared.
The stored entries were built from the old set of columns and cannot be compared against the new one, so until the store is cleared the results will not be what you expect.
The Duplicate Check Store
Each rule has its own store, held on the processing node and configured by the stroom.analytics.duplicateCheckStore property.
The store is keyed on the rule, so it survives the rule being edited.
It is deleted when the rule is deleted.
Note
Because suppression is based on what the rule has already raised, replaying an execution will not re-deliver its detections while suppression is on.
Where you are deliberately re-running something and want the detections again, clear the store first.
4.7 - Streaming Rules
Rules that run against streams as they are processed rather than on a schedule.
A Processor Filter is used to used to find Streams to process through the Pipeline associated with the Processor Filter. A Processor Filter consists of an expression tree to select which Streams to process and a tracker to track the what Streams have been processed.
Click to see more details... rather than by a schedule.
Each StreamStream
A Stream is the unit of data that Stroom works with and will typically contain many Events.
Click to see more details... that matches the filter is passed through the rule as it is processed, so a detection is raised without waiting for the next scheduled run.
Use this type where the delay imposed by a schedule is unacceptable.
For most rules a Scheduled Query is the better choice, because it can look across a window of data rather than at one stream at a time.
Data Source
A streaming rule must query a View , and that View must specify an extraction pipeline.
The View is what makes streaming possible.
Its filter determines which streams are selected for processing, and its extraction pipeline determines the fields the rule’s query can use.
A rule whose query names anything other than a View, or whose View has no pipeline, fails when it is processed rather than when it is saved.
The error is reported against the rule, so a streaming rule that raises nothing at all is worth checking here first.
The Execution tab of a streaming rule shows the rule’s processors and filters, in the same form as the Processors tab of a pipeline.
When a filter is created for the rule, its expression is defaulted from the filter on the View the query uses.
You can then narrow it further, for example to a subset of feeds or a range of stream creation times.
Because streaming rules use the normal stream processing machinery, they behave like any other processing task.
They are picked up by the standard stream processor jobs, not by the Analytic Executor jobs.
Their progress can be tracked, and they can be reprocessed, from the Processors screen.
Their priority competes with other processing on the node.
A streaming rule has no execution schedules, and consequently no execution history, no effective execution time and no catch up behaviour.
Relative date expressions in the query resolve against the time of processing.
Streaming rules are the only type that can use Use Source Feed If Possible on a stream notification, which writes each detection to the feed the source data came from rather than to the destination feed, see Stream Destinations.
Note
A streaming rule sees one stream at a time.
A query that needs to compare data across streams, or count over a period, will not work as a streaming rule and should be a scheduled one.
4.8 - Table Builder Rules
An experimental processing type that should not be used.
Warning
Table Builder is experimental and should not be used.
The in-product help says the same, and the job that runs these rules is disabled by default.
It is documented here only so that anyone who encounters an existing Table Builder rule can recognise what it is.
Use a Scheduled Query or a Streaming rule instead.
A Table Builder rule builds and maintains its own table of data from the streams it processes, and raises detections from that table.
The table is held in shards on the processing node, separately from the rest of Stroom’s data.
The rule’s Shards tab, which is only shown for this processing type, lists those shards and lets you look at what they contain.
Settings
Field
Description
Enabled
Whether the rule is processed.
Processing Node
The node that builds the table.
Min Stream Create Time
The earliest stream creation time to process.
Max Stream Create Time
The latest stream creation time to process.
Aggregation Period
How long to wait for data before processing it.
Time To Keep Data In The Table
How long data is retained in the rule’s table.
Processing Info
A read only summary of what the rule has processed.
5 - Reports
Reports run a query on a schedule and deliver the results as a file, by email or to a feed.
A Report runs a query on a schedule and turns the results into a file, which is then delivered to the people or the FeedFeed
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... you nominate.
Where an Analytic Rule turns each row of its query into a separate detection, a Report turns the whole result table into a single document.
Use a Report when somebody wants a periodic summary of what the data shows, and an Analytic Rule when somebody needs telling about individual things as they are found.
How a Report Relates to an Analytic Rule
Reports and Analytic Rules are built on the same machinery and share most of their configuration.
Anything documented for Analytic Rules applies to Reports unless stated otherwise here.
Tab
Difference from an Analytic Rule
Query
The same, except that the table preferences you set also shape the file produced, see Query.
Included in the report’s Excel info sheet and available to email templates.
The Processing Type on a Report’s Execution tab offers only Scheduled Query.
Reports are always run on a schedule, so there is no streaming or table builder equivalent.
They also have no Duplicate Management tab, because a report is a periodic summary and is expected to repeat.
The Query
The Query tab works as it does on an Analytic Rule, with one important difference.
The table preferences you set by interacting with the results, such as hidden columns, value formats and sort order, are stored on the report and applied when the report is generated.
What you see in the results table while developing the query is therefore what the recipient will get.
Relative date expressions resolve against the report’s effective execution time rather than the current clock time, which is what allows a report for last month to be produced correctly today.
Reports use the same stroom.analytics configuration as Analytic Rules, including the SMTP settings that email delivery depends on, see Email Setup.
The defaults offered in the UI for the processing node, error feed and destination feed come from stroom.ui.reportUiDefaultConfig rather than from the equivalent analytics property.
5.1 - Report Settings
The file type a report produces, whether empty reports are sent, and AI summaries.
The Settings tab controls what kind of file the report produces and what goes in it, and holds the feed that execution errors are written to.
An Analytic Rule has a Settings tab of its own, holding what the rule declares about itself.
A report has none of those settings, because it delivers a file rather than detections.
Comma Separated Values is a file format with typically one record per line and fields delimited by a ,. Fields may be optionally enclosed with double quotes, though there is no fixed standard for CSV data, particularly when it comes to escaping of double quotes and/or commas.
Click to see more details...
Comma delimited. For something else to read.
TSV
Tab delimited. For something else to read.
Excel
Includes an additional Info sheet recording the report name, description, and execution times.
Markdown is a simple markup language for creating rich formatted text using a text editor. Due to the simplicity of the Markdown it is still very readable in its raw form that contains the markup. Markdown is used in Stroom on the Documentation tab of each Document type and in the DocumentationDocument type.
Click to see more details...
For a person to read.
Choose Excel or Markdown where a person will read the report, and CSV or TSV where something else will consume it.
The Excel Info sheet is worth knowing about, because it is where the recipient can see which period the report actually covers.
Send Empty Reports
Field
Description
Send Empty Reports
Whether a report whose query returned no rows is still delivered.
There is a real choice here.
Delivering empty reports means the recipient knows the report ran and there was nothing to say, rather than being left to wonder whether it failed.
Suppressing them avoids a stream of empty files for a report that is usually quiet.
Only emptiness suppresses delivery.
A report that returned rows is always delivered however this is set, and a report that is suppressed is still recorded in the execution history as having run.
Note
The default is to deliver empty reports.
AI Summary
A report can ask a model to summarise the data it produced and deliver that summary with the report.
Field
Description
AI Summary
Whether to ask a model to summarise the report’s data.
AI Summary Model
The model to ask. Where this is not set, the model configured for Ask Stroom AI is used.
AI Summary Prompt
What to ask about the data. Where this is not set, a default prompt asks for a short summary of what the data shows and anything worth attention.
Where the summary ends up depends on the file type, since CSV and TSV cannot carry prose without breaking them for whatever reads them.
File Type
Where the summary goes
Excel
An AI Summary sheet.
Markdown
An AI Summary section after the table.
CSV, TSV
A separate Markdown file delivered alongside the report.
The summary is also available to email templates as aiSummary and is recorded as a ReportAiSummary entry in the stream meta where the report is delivered to a feed.
Note
The report is what the recipient is waiting for, so a model that is unavailable, slow or misconfigured costs the summary and nothing else.
The failure is logged and the report is delivered without a summary.
Warning
AI summaries are a preview feature and are subject to breaking changes in future releases.
Using a model requires the Use permission on the model document rather than the ability to read it.
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... that errors occurring during execution are written to. Use Set Default to use the feed configured for the system.
Delivering a report by email or to a feed, and the template context available to report emails.
The Notifications tab of a Report works in the same way as it does for an Analytic Rule, with the same two destination types and the same limit settings.
The difference is what gets delivered.
A rule delivers a detection, whereas a report delivers the file it produced.
A report can have several notifications, so the same report can be emailed to a distribution list and written to a feed for retention at the same time.
Email Delivery
The report is sent as an attachment, with the subject and body rendered from the notification’s templates.
Where the report is a CSV or TSV and an AI summary was produced, the summary is attached as a second file rather than being packed into an archive, so the recipient does not have to unpack anything.
The file name is derived from the report name and the effective execution time, so a recipient who keeps several editions can tell them apart.
Template Context
Report email templates use the same Jinja syntax as rule detection templates but have a completely different set of variables available, because a report is not a detection.
Variable
Description
reportName
The name of the Report .
description
The content of the report’s Documentation tab.
executionTime
The wall clock time at which the report ran.
effectiveExecutionTime
The point in time the report covers.
rowCount
The number of rows in the report.
fileType
The format of the attached file.
fileName
The name of the attached file.
aiSummary
The AI summary, or an empty string where there is none.
aiSummary is always present so that a template using it renders whether or not a summary was produced.
Note
None of the detection variables, such as detectTime, headline or values, are available to a report template.
A template written for an Analytic Rule will not work on a Report.
A Stream notification writes the report into a FeedFeed
A Feed is a means of organising and categorising data in Stroom. A Feed contains multiple Streams of data that have been ingested into Stroom or output by a Pipeline. Typically a Feed will contain Streams of data that are all from one system and have a common data format.
Click to see more details... as a stream of type Report.
The stream carries the report file itself, unchanged, so anything already reading those streams is unaffected by settings such as the AI summary.
The following entries are written to the stream MetadataMetadata
Metadata refers to the data that describes the Stream data. It is sometimes referred to as just Meta.
Click to see more details....
Meta Key
Description
ReportName
The name of the report.
ReportDescription
The content of the report’s Documentation tab.
ExecutionTime
The wall clock time at which the report ran.
EffectiveExecutionTime
The point in time the report covers.
ReportAiSummary
The AI summary, where one was produced.
Writing reports to a feed is how you retain a record of what was reported and when, independently of whoever received the email.
Note
Use Source Feed If Possible has no effect on a Report, as it only applies to streaming Analytic Rules.
Reports are always written to the Destination Feed.
Limiting
The Limit Notifications, Maximum Notifications and Resume Notifications After settings behave exactly as they do for an Analytic Rule.
They are far less likely to matter for a report, because a report produces one file per run rather than one notification per matching row.
The process of combining data extracted from events with the data stored in an index.
When indexing data it is possible to store (see Stored Fields all data in the index.
This comes with a storage cost as the data is then held in two places; the event; and the index document.
Stroom has the capability of doing Search Extraction at query time.
This involves combining the data stored in the index document with data extracted using a search extraction pipeline.
Extracting data in this way is slower but reduces the data stored in the index, so it is a trade off between performance and storage space consumed.
Search Extraction relies on the StreamId and EventId being stored in the Index.
Stroom can then use these two fields to locate the event in the stream store and process it with the search extraction pipeline.
TODO
Add more detail
7 - Dictionaries
Creating
Right click on a folder in the explorer tree that you want to create a dictionary in.
Choose ‘New/Dictionary’ from the popup menu:
New
Configuration
Dictionary
Call the dictionary something like ‘My Dictionary’ and click
OK
.
Now just add any search terms you want to the newly created dictionary and click .
You can add multiple terms.
Terms on separate lines act as if they are part of an ‘OR’ expression when used in a search.
apple
banana
orange
Terms on a single line separated by spaces act as if they are part of an ‘AND’ expression when used in a search.
apple,banana,orange
Using the Dictionary
To perform a search using your dictionary, just choose the newly created dictionary as part of your search expression: