This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Searching Data

Searching the data held in Stroom using Dashboards, Queries, Views, Analytic Rules and Reports.

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 StroomQl and displays the results as a table or visualisation.

  • Analytic Rule Executes a StroomQl search query either against data as it is ingested into Stroom or on a scheduled basis.

  • Report Executes a StroomQl 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.

1.2 - Statistics

Using Stroom’s statistic stores as a data source.

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

  1. Right-click a folder in the Stroom Explorer pane ( ).
  2. Select:
    New
    Elastic Index
  3. Enter a name for the index document and click OK .
  4. Click next to the Cluster configuration field label.
  5. In the dialog that appears, select the Elastic Cluster document where the index exists, and click OK .
  6. 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.
  7. (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.
  8. (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.
  9. 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.
  10. Click .

Set the Elastic Index Document as the Dashboard Data Source

  1. Open or create a dashboard.
  2. Click in the Query panel.
  3. Click next to the Data Source field label.
  4. Select the Elastic Index document you created and click OK .
  5. Configure the query expression as explained in Dashboards. Note the tips for particular Elasticsearch field mapping data types.
  6. Configure the table.

Query Expression Tips

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:

  1. Click in the Query panel to add a new expression item.
  2. Select the Elasticsearch field name in the drop-down list.
  3. 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 - Data Connections

Querying data held outside Stroom’s own stores: a JDBC database, Amazon Athena or an LDAP directory, or CSV and Excel data held in the document itself.

A Data Connection is one more kind of data source . It lets StroomQl queries, Dashboards and scheduled analytic rules query data that Stroom does not hold in its own indexes or stores, such as a reporting database or a staff directory. Once its rows reach Stroom, every part of StroomQL works on them as it does on any other data source, e.g. where, eval, group by, sort by and select.

Data Connections are read-only. Stroom never writes to the systems they connect to, and cannot join one data source to another.

Types

Each Data Connection has a Type, which decides where its data comes from and how it is queried.

Type Data Queried with Fields
JDBC A database reached through a JDBC driver, e.g. MySQL or PostgreSQL. SQL in each query’s sql clause. The columns the SQL returns.
Amazon Athena Amazon Athena, reached through the AWS SDK. SQL in each query’s sql clause. The columns the SQL returned when it last ran.
LDAP An LDAP directory, e.g. OpenLDAP or Active Directory. An LDAP search filter in each query’s sql clause. dn and the attributes listed in the document.
CSV CSV text held in the document. Stroom’s own clauses only. The columns listed in the document.
Excel An Excel .xlsx workbook held in the document. Stroom’s own clauses only. The columns listed in the document.

The pages for each type describe its settings. The rest of this page applies to them all.

Creating a Data Connection

  1. Right-click a folder in the Stroom Explorer pane ( ).
  2. Select:
    New
    Data Connection
  3. Enter a name for the Data Connection and click OK . Queries name it after from, so a short name without spaces is easiest to type.
  4. On the Settings tab, choose the Type and fill in the settings that appear below it.
  5. Click Test Connection , or for CSV and Excel Check CSV or Check Workbook , to check the settings.
  6. Click .

The settings of every type are kept when you change the Type, so you can switch back without losing them. Only the settings of the chosen type are checked and used.

Settings an administrator controls, such as which JDBC URLs are allowed, are checked when you save, so a mistake is reported straight away. They are checked again whenever the Data Connection connects, as an imported document is not checked on import.

Settings for Every Type

Time Column (optional)
A date column of the data, used to apply a query’s time range. See Time Range. Not used by Amazon Athena.
Query Timeout (seconds)
How long a query may run before it is stopped. An administrator may set a lower ceiling. Not used by CSV and Excel, which are read from the document. Default: 60.
Max Rows
The most rows a query may read. A query with more uses the first ones and warns that the limit was reached. An administrator may set a lower ceiling. Default: 100000.

Querying a Data Connection

Name the Data Connection after from, as for any other data source. For CSV and Excel that is all that is needed, as the data is held in the document, e.g.

from "Teams"
where on_call = true
sort by members desc
select team, members

JDBC, Amazon Athena and LDAP Data Connections also need the query to run in the external system: SQL for JDBC and Athena, or a search filter for LDAP. It goes in a sql clause straight after from, as a string in triple double quotes ("""). A triple-quoted string is taken exactly as written, so it can span lines and hold " and \ without escaping, e.g.

from "Stroom DB"
sql """
  select f.name as feed, t.name as type
  from meta m
  join meta_feed f on f.id = m.feed_id
  join meta_type t on t.id = m.type_id
"""
eval streams = count()
group by feed, type
sort by streams desc
select feed, type, streams

The SQL or filter runs first, in the external system. Its rows then go through the rest of the query in Stroom, like the rows of any other data source. So keep the SQL or filter to what narrows the data, and let Stroom’s clauses do the rest, or do as much as the external system can do faster, as you prefer.

A sql clause is refused for a data source that does not take one, and a JDBC, Athena or LDAP Data Connection without one is refused with an example of the clause.

Fields

The fields of a query are the columns of the rows its data source gives:

  • JDBC: the columns of the SQL. Stroom asks the database to describe the SQL without running it, so the fields are known as you type.
  • Amazon Athena: the columns of the SQL when it last ran, as Athena cannot describe a query without running it and every run is billed. Until the SQL has run once, the field list is empty.
  • LDAP: dn, then each attribute listed in the document.
  • CSV and Excel: the columns listed in the document.

A field the query uses that the data does not have is empty, and the query warns about it. A field used in where that is not a column is an error.

Parameters

The SQL or filter can take values from the query’s parameters, such as those of a dashboard, with a named placeholder: a colon followed by the parameter’s name, e.g. :feed.

from "Stroom DB"
sql """
  select m.id, m.create_time
  from meta m
  join meta_feed f on f.id = m.feed_id
  where f.name = :feed
"""
select id, create_time

A value is never pasted into the SQL or filter as text, so it cannot change it:

  • JDBC binds it as a parameter of a prepared statement.
  • Amazon Athena passes it as an execution parameter, written as a single SQL literal. As Athena receives every value as text, compare it with a number by casting, e.g. where id = cast(:id as bigint).
  • LDAP escapes it as a filter value, so *)(uid=* is matched as text and finds nothing.

A placeholder with no parameter of its name is an error. SQL must use named placeholders: a ? outside quotes is refused.

Time Range

A query’s time range can be applied in two ways.

In the SQL or filter, with the placeholders :from and :to, which take the start and end of the time range, e.g.

select * from events where event_time >= :from and event_time < :to

By default they are timestamps. A format in braces after the name changes them:

Placeholder Value
:from A timestamp for JDBC and Athena, or an LDAP time (GeneralizedTime) for LDAP.
:from{epochMillis} Milliseconds since 1970, as Stroom’s own tables hold times.
:from{epochSeconds} Seconds since 1970.
:from{yyyy-MM-dd} Text in the given date pattern, in UTC.

In Stroom, on the document’s Time Column, when the SQL or filter has no :from or :to. The SQL must return the column, and for LDAP, CSV and Excel it must be a Date column or attribute. This reads every row the SQL or filter returns, so filtering in the SQL is faster on large data.

If neither applies, the time range is ignored and the query warns that it was.

Amazon Athena bills by the data each query scans, so an Athena query with a time range must use :from or :to in its SQL, and is refused otherwise.

Limits and Warnings

A query stops when it has read the document’s Max Rows or runs for its Query Timeout, whichever comes first. An administrator’s ceilings on both apply to every Data Connection.

Problems that do not stop a query are reported as warnings with its results, e.g.:

  • The row limit was reached, so only the first rows were used.
  • The time range was ignored.
  • A field the query uses is not a column of the data.
  • Values were not of their column’s type, so they are empty. The warning counts them and gives an example.
  • For LDAP, a referral was not followed, or the directory’s own size or time limit ended the search.

Closing or stopping a query stops it in the external system too.

Dashboards

A Data Connection can be the data source of a dashboard’s Query panel. CSV and Excel need nothing more.

For JDBC, Amazon Athena and LDAP the query needs its sql clause, which the Query panel’s expression editor has no place for. Write the query in a Query document instead, and show it on the dashboard with an Embedded Query panel.

A dashboard that refreshes automatically reruns the query each time, against the external system. The Minimum Refresh (minutes) setting of JDBC, Amazon Athena and LDAP Data Connections sets the shortest interval at which a dashboard may do so, to protect the system and, for Athena, the cost. A dashboard set to refresh more often is held to the minimum.

Analytics

Scheduled Query rules and Report documents can query a Data Connection. Each run applies the rule’s time range to the time it runs for, using :from and :to or the Time Column as above.

Streaming and table builder rules run over events as Stroom processes them, through a View . A View cannot use a Data Connection, so these rules cannot either.

Permissions

To query a Data Connection a user needs Use permission on the document.

JDBC, LDAP and Amazon Athena Data Connections name a credential to connect with. The credential is used as the user running the query, who needs Use permission on the credential too. A credential that does not exist and one the user may not use give the same error, so the names of credentials cannot be discovered this way.

Testing a connection, and detecting the columns or attributes of the data, use the settings being edited with the credential they name. So they need permission to edit the document as well.

Administration

An administrator controls what Data Connections may connect to with these properties, under stroom.dataConnection. See Properties.

Property Default Purpose
allowedUrlPatterns None Regular expressions a JDBC URL must match one of. With none, no JDBC connection is allowed.
deniedConnectionProperties A list of MySQL and PostgreSQL properties JDBC driver properties a Data Connection may not set, in its URL or its connection properties, because they can read local files, load classes or turn off read-only connections.
driverDirectory None A directory of extra JDBC driver jars, for databases other than MySQL and PostgreSQL, whose drivers Stroom ships. Needs a restart.
allowedAthenaWorkGroups None Regular expressions an Amazon Athena region/workgroup must match one of, e.g. ^eu-west-2/stroom-.*$. With none, no Athena connection is allowed.
allowedAthenaOutputLocations None Regular expressions an Athena output location must match one of. With none, Data Connections may not set one and the workgroup’s is used.
allowDefaultAwsCredentials false Whether an Athena Data Connection with no credential may use Stroom’s own AWS identity.
allowedLdapUrlPatterns None Regular expressions an LDAP URL must match one of, e.g. ^ldaps://directory\.example\.org:636$. With none, no LDAP connection is allowed.
allowPlainLdap false Whether an LDAP Data Connection may connect with plain ldap:// and no StartTLS, sending its password and results unencrypted.
maxStoredDataSize 5M (5 MiB) The most CSV or Excel data a Data Connection may hold.
maxQueryTimeout PT10M The longest query timeout a Data Connection may set.
maxRowsLimit 1000000 The highest row limit a Data Connection may set.
maxPoolSizeLimit 20 The largest JDBC connection pool a Data Connection may set.
connectionPoolCache 100 pools, closed after 10 minutes unused The JDBC connection pools, one per Data Connection.
fieldCache 1000 entries for 10 minutes The columns of each query’s SQL, so editors can list fields without asking the database each time.
tableCache 10 entries, for 10 minutes unused The rows read from the CSV or Excel data of each Data Connection.

With the defaults, no JDBC, Athena or LDAP connection is allowed until an administrator allows one. CSV and Excel Data Connections need no setting.

Example Pack

The Stroom repository holds an import pack of example Data Connections and queries, stroom-data-connection/DataConnection-Examples.zip, for trying them out in a development or test Stroom. Import it with:

Tools
Import

It imports a Data Connection Examples folder holding:

  • Stroom DB, a JDBC Data Connection pointed at Stroom’s own MySQL database, with queries of its nodes, streams and processor tasks.
  • Teams, a CSV Data Connection, and Bank Holidays, an Excel one, each with a query. They need no set-up.
  • People, a CSV Data Connection, and ten Join - … queries that join it to Teams and Bank Holidays: a left join, a semi join with a condition on the joined source, an anti join, a join to a bracketed grouped query, a join on a date, where exists, where not exists, where ... in, a right join and a full outer join. They need no set-up either, see Joins.
  • Directory, an LDAP Data Connection, with queries of the people in a directory.

The Documentation tab of each JDBC and LDAP Data Connection gives its set-up steps. Change its URL to your own database or directory first, as the queries will otherwise read a different one, or none.

1.4.1 - JDBC Data Connections

Querying a database with SQL through a JDBC driver.

A JDBC Data Connection connects to a database through a JDBC driver. Each query gives the SQL to run in a sql clause, and the columns of its result become the query’s fields.

Stroom ships the MySQL and PostgreSQL drivers. An administrator can add drivers for other databases by putting their jars in the directory named by the stroom.dataConnection.driverDirectory property.

Settings

JDBC URL
The JDBC URL of the database, e.g. jdbc:mysql://reporting-db:3306/reports. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedUrlPatterns property. Do not put a user name or password in it; choose a credential instead.
Credential
The Username / Password credential to connect with. You need Use permission on it, as does anyone who queries this Data Connection.
Connection Properties
Extra JDBC driver properties, one name=value per line. For MySQL, add useCursorFetch=true so large results are read in batches of the fetch size rather than all at once.
Max Pool Size
The most connections Stroom keeps open to this database at once. An administrator may set a lower ceiling. Default: 5.
Fetch Size
How many rows are fetched from the database in each round trip. 0 uses the driver’s own default. Default: 1000.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically, to limit the load on the database. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 0.

The Time Column, Query Timeout and Max Rows settings are described in Settings for Every Type.

Test Connection connects with the settings as they stand and reports the database and driver it reached, and the user it connected as.

Writing the SQL

The SQL is a single statement that returns rows, given in a triple-quoted sql clause, e.g.

from "Reports DB"
sql """
  select name, team, joined
  from staff
  where joined >= :from and joined < :to
"""
where team = "Platform"
select name, joined
  • A ; is only allowed at the end, so a query cannot run a second statement.
  • Use named placeholders such as :team for values, not ?, which is refused outside quotes. See Parameters and Time Range.
  • Give each column the name you want as its field, with as if needed, e.g. count(*) as streams. A field matches a column of the same name, or failing that a column whose name differs only in case, as some databases change the case of names that are not quoted.

Stroom asks the database to describe the SQL without running it, so the fields are listed in the query editor as you write the SQL.

Column Types

Each column is read as a Stroom field type, from the type the driver reports:

Database type Field type
TINYINT, SMALLINT, INTEGER Integer
BIGINT Long
DECIMAL and NUMERIC with no fraction and up to 18 digits Long
REAL, FLOAT Float
DOUBLE, and other DECIMAL and NUMERIC Double
BOOLEAN, BIT Boolean
DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE Date
Anything else Text

A date or timestamp with no time zone is taken as UTC. An unsigned BIGINT too large for a Long is read as a Double.

Stroom’s own tables hold times as milliseconds since 1970 in BIGINT columns. To read them as dates, convert them in the SQL, e.g. from_unixtime(create_time / 1000) in MySQL, and compare them with the time range using :from{epochMillis} and :to{epochMillis}.

Security

Stroom asks for read-only connections, turning off auto-commit so that PostgreSQL connections are read-only too. Only the database can enforce what an account may do, so the credential should be for an account that can only read the tables Stroom should query.

An administrator’s controls are checked when the Data Connection is saved and again whenever it connects:

  • The URL must match one of the stroom.dataConnection.allowedUrlPatterns patterns.
  • Embedded databases (jdbc:h2:, jdbc:hsqldb:, jdbc:derby: and jdbc:sqlite:) are refused, as they read files on the Stroom server.
  • Driver properties that can read local files, load classes or turn off read-only connections are refused, whether in the URL or the connection properties. The list is the stroom.dataConnection.deniedConnectionProperties property. For MySQL and PostgreSQL the URL is read by the driver’s own parser, so a property cannot be hidden in it. The URLs of other databases cannot contain % or (; set their properties as connection properties instead.
  • A user name or password in the URL or connection properties is refused, so a secret is never stored in the document.

1.4.2 - Amazon Athena Data Connections

Querying Amazon Athena with SQL through the AWS SDK.

An Amazon Athena Data Connection runs SQL in Amazon Athena through the AWS SDK. Each query gives the SQL to run in a sql clause, and the columns of its result become the query’s fields.

Athena bills by the data each query scans, so several settings and rules here exist to keep the cost in check.

Settings

AWS Region
The AWS region of the Athena workgroup, e.g. eu-west-2.
Workgroup
The Athena workgroup queries run in. The region and workgroup, written region/workgroup, must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedAthenaWorkGroups property. The workgroup’s per-query data scan limit is the control on cost. Default: primary.
Data Catalog
The data catalog queries run in. Default: AwsDataCatalog.
Database
The database queries run in. Default: default.
Output Location (optional)
The S3 URI query results are written to, e.g. s3://my-bucket/athena/. Leave it empty to use the workgroup’s. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedAthenaOutputLocations property; with none, it must be left empty.
Credential
The AWS Access Key credential to query with. You need Use permission on it, as does anyone who queries this Data Connection. With none, Stroom’s own AWS identity is used, but only if an administrator has turned on the stroom.dataConnection.allowDefaultAwsCredentials property.
Result Reuse (minutes)
How old a result of the same query may be and still be reused instead of running the query again. Athena bills every run, so this saves cost when the same query is run again. 0 never reuses a result. Default: 0.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically. Result reuse rarely helps a dashboard, as its time range changes on every refresh, and many refreshes also use up the account’s limit on Athena queries running at once. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 5.
Max Data Scanned (MB)
The most data, in MB, a query may scan before Stroom stops it. Stroom checks while the query runs, so a query may pass the limit by what it scans between two checks. The workgroup’s own per-query data scan limit is the one Athena enforces exactly, so set that too. 0 sets no limit beyond the workgroup’s. Default: 0.

The Query Timeout and Max Rows settings are described in Settings for Every Type. Athena takes the time range in its SQL, so it has no time column.

Test Connection runs no query, as every query is billed. It looks up the workgroup and the database, which checks the credential, region, workgroup and database. It reports the workgroup’s data scan limit and result location, or that none is set, and whether the workgroup enforces its own settings.

Writing the SQL

The SQL is a single statement that returns rows, given in a triple-quoted sql clause, e.g.

from "Events"
sql """
  select event_time, user_name, action
  from sign_ins
  where event_time >= :from and event_time < :to
    and outcome = 'FAILED'
"""
eval failures = count()
group by user_name
sort by failures desc
select user_name, failures
  • Only SQL that starts with SELECT, WITH, VALUES, SHOW or DESCRIBE is run, as an Athena connection cannot be made read-only. That refuses CREATE TABLE AS, INSERT and UNLOAD.
  • A ; is only allowed at the end, so a query cannot run a second statement.
  • A query with a time range must use :from or :to in its SQL, and is refused otherwise. Filtering in Stroom after Athena had scanned everything would cost money for nothing.
  • Athena receives every parameter as text, written as a single SQL literal. To compare one with a number, cast it, e.g. where id = cast(:id as bigint).

See Parameters and Time Range.

Fields

Athena cannot describe a query without running it, and every run is billed. So the fields of a query are only known once its SQL has run; until then the field list is empty. After a run, the fields are remembered for a while, so the query editor can list them.

Cost

Each run reports the data Athena scanned with its results.

A query is stopped in Athena, not just in Stroom, when it is cancelled, when it reaches the query timeout or the Max Data Scanned limit, or when Stroom fails after starting it.

Security

  • The region and workgroup must match one of the stroom.dataConnection.allowedAthenaWorkGroups patterns.
  • An output location must match one of the stroom.dataConnection.allowedAthenaOutputLocations patterns. Every query writes its full result there, with the AWS identity of the user running it.
  • A Data Connection must name an AWS access key credential, unless stroom.dataConnection.allowDefaultAwsCredentials is on. Otherwise any user who can create a document could query whatever Stroom’s own AWS identity can read.
  • Use AWS identities that can only read the tables Stroom should query. Federated queries pass SQL to connectors that Stroom cannot see into, so their accounts should only be able to read too.

1.4.3 - LDAP Data Connections

Searching an LDAP directory, such as OpenLDAP or Active Directory, with a search filter.

An LDAP Data Connection searches an LDAP directory. Each query gives an LDAP search filter in a sql clause, and each entry it finds becomes a row. The fields are dn and the attributes listed in the document.

Settings

LDAP URL
The directory’s URL: its scheme, host and port only, e.g. ldaps://directory.example.org:636. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedLdapUrlPatterns property. A URL that also gives a base DN, attributes, scope or filter is refused; set those in their own places.
Use StartTLS
Whether to start TLS on an ldap:// connection before binding, so the password and results are encrypted. An ldaps:// connection is always encrypted. Plain ldap:// without StartTLS can only be used if an administrator turns on the stroom.dataConnection.allowPlainLdap property. Default: off.
Credential
The Username / Password credential to bind with. Its username is the full bind DN, e.g. cn=stroom-reader,ou=Services,dc=example,dc=org. You need Use permission on it, as does anyone who queries this Data Connection. Anonymous binds are not allowed, so a credential is required, and it must have a password.
Base DN
Where searches start, e.g. ou=People,dc=example,dc=org. Queries cannot search outside it.
Scope
How far below the base DN searches reach: the base entry only, the entries directly below it, or the whole subtree. Default: the whole subtree.
Page Size
How many entries are fetched in each page of results. Default: 500.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically, to limit the load on the directory. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 0.
Attributes
The attributes read from each entry, each with a type. See Attributes.

The Time Column, Query Timeout and Max Rows settings are described in Settings for Every Type.

Test Connection connects, starts TLS if set, binds and reads the base DN’s entry. It reports the directory’s vendor, and whether the directory supports paged results.

Attributes

The fields of a query are dn, which every entry has, then each attribute in the Attributes table, in order. An attribute an entry does not have is empty.

Detect Attributes reads the first 100 entries below the base DN and adds the attributes they have to the table, with the type their values suggest. Attributes already in the table stay, in their place and with their type, so a type you chose survives detecting the attributes again. It also asks for createTimestamp and modifyTimestamp, which most directories keep but only return when asked for by name.

Directories return some attributes only when asked for by name, such as operational attributes, and an attribute may only be on later entries. Add these to the table by name, and remove the ones you do not need, as each attribute is fetched from the directory for every entry.

Each attribute is read as its type:

Type Reads
Text Any attribute. An attribute with several values, such as memberOf, gives them all, joined by ; . Binary values, such as objectGUID, are given in base64.
Long, Double A number.
Boolean TRUE or FALSE, as LDAP writes them, in any case.
Date An LDAP time (GeneralizedTime), such as createTimestamp or whenCreated, or an Active Directory FILETIME number, such as lastLogonTimestamp or pwdLastSet. A FILETIME of 0, or the largest possible value, means no time and is empty.

An attribute with more than one value, or a binary value, can only be read as Text. A value that is not of its attribute’s type is empty, and the query warns about it. Detect Attributes suggests Date only for LDAP times, so set FILETIME attributes to Date yourself.

Writing the Filter

The filter is a standard LDAP search filter, given in a triple-quoted sql clause, e.g.

from "Directory"
sql """
(&(objectClass=person)(departmentNumber=:department))
"""
sort by cn
select cn, uid, mail

The brackets around a filter may be left off, e.g. objectClass=person.

A placeholder takes the value of the query parameter of its name, and :from and :to take the time range as LDAP times, e.g. (modifyTimestamp>=:from). See Parameters and Time Range.

Each value is escaped as an LDAP filter value, so it can only ever be matched and never change the filter.

  • A colon also appears in extensible match filters, such as (cn:caseExactMatch:=Fred), and in values such as times and URLs. So a colon only starts a placeholder where a value starts, straight after =, ~=, >= or <=, or after a * wildcard. A value that must start with a colon followed by a letter writes the colon as \3a.
  • Values are escaped for the filter, not for a DN. So in a DN-valued filter such as (member=uid=:user,ou=People,dc=example,dc=org), a parameter holding a comma could compare a different DN, though never change the filter. Give the whole DN as one parameter instead, e.g. (member=:memberDn).

Searching

  • Entries are fetched a page at a time with the simple paged results control, so a search can read more entries than the directory returns at once. The control is not marked critical, so a directory without it still answers, within its own size limit.
  • The search stops at the Data Connection’s Max Rows.
  • If the directory’s own size or time limit for the bind account ends a search, the query keeps the entries read so far and warns. Narrow the filter, or ask the directory’s administrator to raise the limit.
  • Referrals to other servers are not followed, as the allowed LDAP URLs may not include them. The query warns how many there were. Search those servers with Data Connections of their own.

Security

  • The URL must match one of the stroom.dataConnection.allowedLdapUrlPatterns patterns.
  • The connection must be encrypted, with ldaps:// or StartTLS, unless stroom.dataConnection.allowPlainLdap is on. Plain LDAP sends the bind password and every result unencrypted, so only use it for test directories.
  • The directory’s certificate must be trusted by Stroom’s Java trust store and name the host in the URL.
  • Directories hold personal data, so use a bind account the directory lets read only the entries and attributes Stroom needs.
  • Stroom’s LDAP client never turns what a directory returns into Java objects, so a directory cannot make Stroom load code.

Active Directory

Active Directory names some attributes differently from the standard inetOrgPerson ones, e.g.:

Standard Active Directory
uid sAMAccountName
departmentNumber department
createTimestamp whenCreated
modifyTimestamp whenChanged

Its global catalog, on ports 3268 and 3269, can search a whole forest without referrals. Times such as lastLogonTimestamp, pwdLastSet and accountExpires are FILETIME numbers: set their type to Date to read them as dates.

1.4.4 - CSV and Excel Data Connections

Querying CSV text or an Excel workbook held in the Data Connection itself.

A CSV or Excel Data Connection holds its data in the document itself, so it needs no connection and no credential. It suits small lookup tables and reference lists, such as teams, sites or holidays, that queries and dashboards can use alongside Stroom’s own data. Bulk data belongs in a Feed .

The data is queried with Stroom’s own clauses alone, so a query has no sql clause, e.g.

from "Bank Holidays"
where region = "All" or region = "Scotland"
sort by date
select date, holiday

The data is held, exported and imported with the document. An export keeps it in a file of its own beside the document’s JSON: the CSV as text, in a .csv file, and the workbook as the original .xlsx file.

An administrator sets the most data a Data Connection may hold with the stroom.dataConnection.maxStoredDataSize property, 5M (5 MiB) by default. Saving more is refused.

Columns

The fields of a query are the columns in the document’s Columns table, in the order their values appear in each row. Each column has a name, which becomes the field name, and a type, which its values are read as:

Type Values
Text Anything, kept as it is.
Long Whole numbers.
Double Numbers that may have a fraction.
Date Dates and times in ISO 8601 with a four-digit year, e.g. 2026-11-12 or 2026-11-12T09:30:00Z. A space may stand for the T. A time with no zone is taken as UTC; a zone is Z or an offset such as +01:00, +0100 or +01.
Boolean true or false, in any case.

A value that is not of its column’s type is empty, and the query warns about it, giving the number of such values and an example.

Detect Columns reads the first 1,000 rows and fills in the table:

  • Each column is named from the header row, if there is one. A column with no name in the header, or with no header row, is named column1, column2 and so on, and a repeated name has a suffix added, as each column needs a field name of its own. Names that differ only in case, such as Team and team, count as repeated, as fields are matched without regard to case.
  • Each column’s type is guessed from its values: the narrowest of Long, Double, Date and Boolean that all of them are, or else Text. Numbers that would lose something as a number stay Text, such as codes with leading zeros, e.g. 0123, and whole numbers too big for a Long, such as long identifiers.
  • A column already in the table keeps the type you chose for it, even if the case of its name in the header has changed, so you can detect the columns again after changing the data.

If the header row no longer matches the columns in the table, because the data changed after they were detected, a query warns that values may be under the wrong fields. Detect the columns again.

CSV

Delimiter
The character between the values of each row: comma, semicolon, tab or pipe. Default: comma.
First Row Is A Header
Whether the first row holds the column names. Default: on.
CSV
The data. Paste it in, or click Load From File to read a file from your computer, which then detects the columns. Values are read as CSV, so a value holding the delimiter, a quote or a line break is quoted in " double quotes, with any " inside written twice.

Changing the delimiter or the header setting detects the columns again.

Check CSV reads all of the CSV and reports how many rows and columns it has, and any values that are not of their column’s type.

Excel

Workbook
The Excel workbook. Choose an .xlsx file: it is uploaded straight away, which detects the columns, and stored with the document when you save. Older .xls workbooks cannot be read; save them as .xlsx in Excel first. Download downloads the stored workbook, e.g. to edit it in Excel and upload it again. Remove removes it when you save.
Sheet (optional)
The name of the sheet to read. Leave it empty to read the first sheet.
First Row Is A Header
Whether the first row with values holds the column names. Default: on.

Excel values are read as Excel worked them out:

  • Numbers are read as plain numbers, whatever their format in Excel, e.g. 1234.5 for a cell shown as £1,234.50.
  • Dates are read as dates, including in workbooks that count dates from 1904, as older Mac versions of Excel did.
  • Formulas are read as the value Excel last worked out for them; Stroom does not work them out again.

Check Workbook reads all of the sheet and reports how many rows and columns it has, and any values that are not of their column’s type.

The browser never holds the workbook: it is uploaded to Stroom, and downloaded only when you ask.

Time Range and Other Settings

If the document names a Time Column, which must be a Date column, a query’s time range filters the rows on it. With none, the time range is ignored, and the query warns that it was.

The data only changes when the document does, so CSV and Excel Data Connections have no query timeout and no minimum refresh. The rows read are cached for each version of the document, so a dashboard that refreshes does not read the data again.

1.5 - 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 Document 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

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 Stream (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).
Type String The Stream Type , 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

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.

  <div style="padding: 5px;">
    <span style="text-decoration:underline;color:blue;cursor:pointer" link="[link](uuid=e177cf16-da6c-4c7d-a19c-09a201f5a2da&amp;params=user%3Duser1&amp;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>
{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>
{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>

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.

The format for a dashboard link is as follows:

[Link Text](uuid=<UUID>&params=<PARAMS>&title=<CUSTOM_TITLE>){dashboard}

The parameters for dashboard links are:

  • uuid - The UUID of the dashboard to open.
  • params - A URL encoded list of params to supply to the dashboard, e.g. params=user%3Duser1.
  • title - An optional URL encoded title to better identify the specific instance of the dashboard, e.g. title=Details%20For%20user1.

An example of this type of link in HTML:

<div style="padding: 5px;">
    <span style="text-decoration:underline;color:blue;cursor:pointer" 
          link="[link](uuid=e177cf16-da6c-4c7d-a19c-09a201f5a2da&amp;params=user%3Duser1&amp;title=Details%20For%20user1){dashboard}">
        Details For user1
    </span>
</div>

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.

The format for a data link is as follows:

[Link Text](id=<STREAM_ID>&partNo=<PART_NO>&recordNo=<RECORD_NO>&lineFrom=<LINE_FROM>&colFrom=<COL_FROM>&lineTo=<LINE_TO>&colTo=<COL_TO>&viewType=<VIEW_TYPE>&displayType=<DISPLAY_TYPE>){data}

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.

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&amp;partNo=1&amp;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.

<div style="padding: 5px;">
    <span style="text-decoration:underline;color:blue;cursor:pointer" 
          link="[link](id=1822&amp;partNo=1&amp;recordNo=1&amp;viewType=preview&amp;lineFrom=1&amp;colFrom=1&amp;lineTo=10&amp;colTo=8){data}">
        Show Source Preview
    </span>
</div>

In source mode the optional parameters lineFrom, colFrom, lineTo, colTo can be used to highlight a portion of the data that is displayed.

<div style="padding: 5px;">
    <span style="text-decoration:underline;color:blue;cursor:pointer" 
          link="[link](id=1822&amp;partNo=1&amp;recordNo=1&amp;viewType=source&amp;lineFrom=1&amp;colFrom=1&amp;lineTo=10&amp;colTo=8){data}">
        Show Source
    </span>
</div>

Display Type

Choose whether to display data in a dialog (default) or a Stroom tab.

Stepping

A stepping link can be used to launch the data stepping feature with the specified data. The format for a stepping link is as follows:

[Link Text](id=<STREAM_ID>&partNo=<PART_NO>&recordNo=<RECORD_NO>){stepping}

The parameters for stepping links are as follows:

  • id - The id of the stream to step.
  • partNo - The sub part no within the stream to step (usually 1).
  • recordNo - The record or event number within the stream to step.

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&amp;partNo=1&amp;recordNo=1){stepping}">
        Step Source</span>
</div>

Annotation

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:

[Link Text](annotationId=<ANNOTATION_ID>&streamId=<STREAM_ID>&eventId=<EVENT_ID>&title=<TITLE>&subject=<SUBJECT>&status=<STATUS>&assignedTo=<ASSIGNED_TO>&comment=<COMMENT>){annotation}

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.

URL Format

The format for the URL is as follows:

https://<HOST>/stroom/dashboard?type=Dashboard&uuid=<DASHBOARD UUID>[&title=<DASHBOARD TITLE>][&params=<DASHBOARD PARAMETERS>]

Example:

https://localhost/stroom/dashboard?type=Dashboard&uuid=c7c6b03c-5d47-4b8b-b84e-e4dfc6c84a09&title=My%20Dash&params=userId%3DFred%20Bloggs

Host and Path

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.

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 Dashboard 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.

from <DATA_SOURCE> [as <ALIAS>]
[sql] """<NATIVE_QUERY>"""
[join] <DATA_SOURCE> [as <ALIAS>] on <FIELD> = <ALIAS>.<FIELD> [and ...]
where <FIELD> <CONDITION> <VALUE> [and|or|not]
[and|or|not]
[window] <TIME_FIELD> by <WINDOW_SIZE> [advance <ADVANCE_SIZE>] [offset <OFFSET>]
[filter] <FIELD> <CONDITION> <VALUE> [and|or|not]
[and|or|not]
[eval...] <FIELD> = <EXPRESSION>
[having] <FIELD|EXPRESSION> <CONDITION> <VALUE|EXPRESSION> [and|or|not]
[group by] <FIELD>
[sort by] <FIELD> [desc|asc] // asc by default
[limit] <MAX_ROWS> 
select <FIELD> [as <COLUMN NAME>], ...
[show as] <VIS_NAME> (<VIS_CONTROL_ID_1> = <COLUMN_1>, <VIS_CONTROL_ID_2> = <COLUMN_2>)

For the full grammar, see StroomQL Grammar.

Fields

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"

Sql

Some data sources run a query of their own before Stroom works on the results: a Data Connection of type JDBC or Amazon Athena runs SQL, and one of type LDAP runs a search filter. That query goes in a sql clause, straight after the data source it is for, e.g. after from:

from "Reports DB"
sql """
  select name, team, joined
  from staff
  where joined >= :from and joined < :to
"""
where team = "Platform"
sort by joined desc
select name, joined

The SQL or filter is a string, usually in triple double quotes ("""). A triple-quoted string is taken exactly as written: it can span several lines and hold " and \ without escaping, and it ends at the next """.

Its results become the rows that the rest of the query works on, so where, eval, group by and the other clauses work on them as on any other data source. Named placeholders such as :team take the value of the query parameter of that name, and :from and :to take the ends of the query’s time range.

A data source that needs a sql clause refuses a query without one, and one that does not take one refuses a query with one.

A joined data source can have a sql clause too, straight after it in its join line, and a bracketed query has its own inside its brackets, straight after its from, e.g.

from "Windows events"
left join "Reports DB" as staff sql """
  select username, team
  from staff
""" on UserId = staff.username
select UserId, staff.team

Join

Use join to join the rows of another data source to the rows of the query, straight after from, e.g.

from "Windows events"
left join "HR Users" as hr on UserId = hr.Username
select UserId, hr.Department

The kinds of join are join, left join, right join, full join, semi join and anti join. The joined fields are named <alias>.<field>, e.g. hr.Department, where the alias is the name after as, or the data source’s name if there is none. If that name has spaces, write its fields in braces, e.g. ${HR Users.Department}.

The joined source can also be a bracketed query, and a query can have several join lines.

See Joins for the kinds of join and examples.

On

Use on to give the keys of a join, whose values must be equal for rows to join, e.g.

on lowerCase(UserId) = hr.Username and Host = hr.Host

Keys match exactly, so case matters, and a blank key never matches.

An event-to-event join can also give a time window after its keys, e.g.

from "Windows events" as logon
join "File events" as export
  on logon.UserId = export.UserId
  within 10m after logon.EventTime
select logon.UserId, logon.EventTime, export.FileName

See Joining Events Within a Time Window.

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 UUID ).

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)

Exists and In

Use exists to keep only the rows that have a match in another data source, or not exists to keep those with none, as in SQL, e.g.

from People as p
where exists (from Teams as t where t.team = p.team and t.on_call = true)
select name, team

Use in or not in to compare a field with the one field another data source’s query selects, e.g.

from People
where team not in (from Teams select team)
select name, team

These are other ways of writing a semi join and an anti join, and run as them. They can only be used at the top level of where, joined to its other conditions by and. See Exists and In.

Window

window <TIME_FIELD> by <WINDOW_SIZE> [advance <ADVANCE_SIZE>] [offset <OFFSET>]

Use window to put rows into windows of time and to group them by the window they are in, e.g.

from "File events"
window EventTime by 1d
group by UserId
select windowStart() as Day, UserId, count() as Events

This gives a row for each user for each day. Rows are grouped by their window as well as by the group by columns. No columns are added to the table, so select windowStart() or windowEnd() to show the times of a row’s window.

A window includes its start and not its end, so an event at midnight is in the day that starts then. The time field must hold a date and time. A field that the data source lists as some other type is refused. Rows with no time in the field are left out, and the search gives a warning that says how many.

Window Sizes

A size is a number and a unit, e.g. 10m or 1d.

Unit Meaning
ms Milliseconds
s Seconds
m Minutes
h Hours
d Days
w Weeks
M Months
y Years

Sizes in hours or less are fixed lengths of time, counted from midnight, so windows of 1h start on the hour and 24h is always 24 hours.

Sizes in days, weeks, months and years follow the calendar in the time zone of the query. A window of 1d is 23 or 25 hours long when the clocks change, weeks start on Monday and months on the 1st. An analytic rule that has no time zone uses UTC.

Overlapping Windows

Add advance to make windows that overlap, e.g.

window EventTime by 1h advance 10m

A window of an hour then starts every 10 minutes, and each event is counted in every window that covers it, which is six windows here. Without advance, each window starts where the one before it ends.

The size must be a whole number of advances. The advance can be in a smaller unit than the size where the units divide exactly, so a year can advance by months, a week by days or less and a day by hours or less. Months and years can’t advance by weeks, days or less.

Offset

Add offset to move where windows start, e.g.

window EventTime by 1d offset 6h

Each day then runs from 06:00 to 06:00. Use a minus sign to move the start earlier, e.g. offset -2h. advance and offset can be given in either order.

Comparing Windows

Use lag() and lead() to compare a window with an earlier or later one, e.g.

from "File events"
window EventTime by 1d
eval Change = count() - lag(count(), 1)
group by UserId
select windowStart() as Day, UserId, count() as Events, Change

lag(count(), 1) is the count of the window one size before, for the same user, and lead(count(), 1) is the count of the window one size after. The other window is a number of sizes away, whatever the advance, so with by 1h advance 10m it is the window that starts an hour before.

What lag() and lead() give depends on the other window:

  • A window that has events gives the value of the aggregate for it.
  • A window with no events for the group gives the empty value of the aggregate, which is 0 for count().
  • A window before the first window that has events, or after the last, gives no value. The first and last windows are those of all the events of the search, not of the group.

Give a third value to use where there is no value, e.g. lag(count(), 1, 0).

A user with no events in a window still gets a row for that window if a window either side of it reads it, and the window is not before the first or after the last that has events. In the example above, a user with events on Monday and none on Tuesday gets a row for Tuesday with Events of 0 and Change of minus Monday’s count, as long as another user has events on Tuesday or later.

To keep only the windows that have changed, compare them in having, e.g.

from "File events"
window EventTime by 1d
group by UserId
having count() > lag(count(), 1) * 2
select windowStart() as Day, UserId, count() as Events

Window Limits

  • An event is added to the results once for each window it is in, and once more for each of those for each different distance used by lag() and lead(). A query that would add an event more than 100 times is refused. Administrators set this limit with the search.resultStore.maxWindowCopiesPerEvent property.
  • window can be used in a bracketed query and with a join, but not with a join within a time window.
  • lag() and lead() can only be used in a query that has a window clause.

Filter

Use filter to test values that where can’t, such as a field that has not been indexed or the result of an eval. It is written the same way as the where clause, but is tested on each row after its values have been retrieved, rather than being part of the search, e.g.

from my_source
where feed = "my feed"
eval domain = substringAfter(user, "@")
filter obscure_field = "some value" and domain = "example.com"
select user, domain, obscure_field

where names fields of the data source, but filter names the columns of select, so a column must be selected to be filtered on. If a column is renamed with as, filter uses the new name.

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.

Text is compared without regard to case, and * and ? can be used as wildcards with = and !=.

See Filter for the differences between where and filter in full.

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.

eval new_name = concat(
  substring(name, 3, 5),
  substring(name, 8, 9))

Note that all fields in the data source selected using from will be available as variables by default.

Multiple eval statements can also be used to breakup complex function expressions and make it easier to comment out individual evaluations, e.g.

eval name_prefix = substring(name, 3, 5)
eval name_suffix = substring(name, 8, 9)
eval new_name = concat(
  name_prefix,
  name_suffix)

Variables can be reused, e.g.

eval name_prefix = substring(name, 3, 5)
eval new_name = substring(name, 8, 9)
eval new_name = concat(
  name_prefix,
  new_name)

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. A condition can test a column by its name, e.g.

having count > 3

A condition can also test an expression, so the value does not have to be a column, e.g.

having count() > 3 and max(Bytes) < 1000

Two expressions can be compared with =, !=, >, >=, < or <=, e.g.

having count() > lag(count(), 1) * 2

A single name on the right of a comparison is a column if an eval or select gives one of that name, and text if not.

A row is kept only if the comparison is true, so a row with nothing to compare with is left out. With window, this means the first window that has events is left out of a comparison with lag(). To keep it, give lag() a value to use, e.g. lag(count(), 1, 0).

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
limit 10
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count
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
limit 10
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count
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
// limit 10
select StreamId as "Stream Id", EventId as "Event Id"
from "index_view" // view
// add each user's department, keeping users not in the HR list
left join "HR Users" as hr on UserId = hr.Username
where EventTime > now() - 1227d
eval count = count()
group by UserId, hr.Department
sort by count desc
select UserId as "User Id", hr.Department as "Department", count
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
limit 10
select Sl, StreamId as "Stream Id", EventId as "Event Id", EventTime as "Event Time", UserId as "User Id", FirstName, count

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.
  • Functions - The list of Expression Functions that can be used.
  • Visualisations - The list of Visualisation documents that can be included in the Query .
  • Dictionaries - The list of Dictionary documents that can be used in in dictionary terms.

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 includes completion snippets.

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:

  1. Type sub then hit Ctrl ^ , Space ␣ .
  2. Select substring(..) from the list and hit Tab ↹ .
    substring(input, startIndex, endIndex) is inserted, with input highlighted.
  3. Type Feed to replace input with Feed, then hit Tab ↹ .
    substring(Feed, startIndex, endIndex) is displayed, with startIndex highlighted.
  4. Type 0 to replace startIndex with 0, then hit Tab ↹ .
    substring(Feed, 0, endIndex) is displayed, with endIndex highlighted.
  5. 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.

3.2 - Joins

Joining the rows of one data source to those of another in a StroomQL query.

A join adds the rows of another data source, the joined source, to the rows of a StroomQl query, matching them on keys. For example, a join can add each user’s department from an HR list to their logon events, or find the logons of users who are not in the HR list at all.

Any data source can be joined to any other, e.g. an index to a Data Connection, or an index to itself.

Join lines go straight after from:

from "Windows events"
left join "HR Users" as hr on UserId = hr.Username
select UserId, hr.Department

The joined source is searched first and held. The first source is then searched as usual, and each of its rows is joined as it arrives, so results appear as the search runs, as they do without a join.

For the full grammar, see StroomQL Grammar.

Kinds of Join

images/user-guide/search/queries/joins/joins-venn.svg

The rows each kind of join gives
Join Also written Rows given Joined fields
join inner join One row per match; rows with no match are dropped. Added.
left join left outer join One row per match; rows with no match are kept. Added, blank when there is no match.
right join right outer join One row per match; rows of the joined source with no match are kept. Added; the first source’s fields are blank when there is no match.
full join full outer join One row per match; rows of either source with no match are kept. Added, blank where there is no match.
semi join left semi join, where exists, where ... in Each row with at least one match, once. None.
anti join left anti join, where not exists, where ... not in Each row with no match. None.

A join and a semi join give the same rows, but a semi join adds no fields and never repeats a row, so use it to keep only the rows that have a match.

Examples

The examples below use the People and Teams CSV Data Connections from the Example Pack, where each example is also a query.

People:

name team started
Alice Platform 2025-01-13
Ben Data 2026-04-03
Chloe Security 2025-09-01
Dev Analysis 2026-05-25
Ella Platform 2024-06-17
Femi Design 2026-02-09
Gus Support 2025-11-03

Teams:

team members founded on_call
Platform 6 2019-03-01 true
Data 4 2021-07-15 false
Security 5 2020-11-02 true
Analysis 8 2018-05-20 false
Support 3 2024-01-08 true
Research 2 2022-02-14 false

Femi’s team, Design, is not in Teams, and no one in People is in Research.

Adding Fields from Another Source

A left join gives every person, with their team’s fields:

from People
left join Teams as t on team = t.team
sort by name
select name, team, t.members as members, t.on_call as on_call
name team members on_call
Alice Platform 6 true
Ben Data 4 false
Chloe Security 5 true
Dev Analysis 8 false
Ella Platform 6 true
Femi Design
Gus Support 3 true

The joined fields are named with the alias, as in t.members. The alias is the name after as, or the data source’s name if there is none. If that name has spaces, write its fields in braces, e.g. ${HR Users.Department}.

A plain join would give the same rows without Femi, who has no match.

Keeping Rows with or without a Match

A semi join keeps each person whose team is on call, without adding the team’s fields:

from People
semi join Teams as t on team = t.team
where t.on_call = true
sort by name
select name, team

This gives Alice, Chloe, Ella and Gus.

An anti join gives the opposite: each row with no match. It is useful for finding rows that refer to something that doesn’t exist:

from People
anti join Teams as t on team = t.team
select name, team

This gives Femi.

Exists and In

where exists, where not exists, where ... in and where ... not in are the SQL ways of writing semi and anti joins, and run as them. This query gives the same rows as the semi join above:

from People as p
where exists (from Teams as t where t.team = p.team and t.on_call = true)
sort by name
select name, team

The bracketed query names the first source’s fields by its alias, here p, or by its data source’s name if it has no alias, and compares them using =. Its other conditions, here t.on_call = true, narrow its own search.

in compares a field with the one field the bracketed query selects:

from People
where team in (from Teams select team)
sort by name
select name, team

These forms can only be used at the top level of where, joined to its other conditions by and.

Right and Full Joins

A right join gives every row of the joined source: here, every team, with a row for each person in it.

from People
right join Teams as t on team = t.team
sort by t.team, name
select t.team as team, name

Research is given once, with a blank name, as no one is in it. Femi is not given, as Design is not in Teams.

A full outer join gives every row of both:

from People
full outer join Teams as t on team = t.team
sort by t.team, name
select name, team, t.team as listed_team, t.members as members

This gives a row for each person in a team, Femi with blank team fields, and Research with a blank name.

The rows of the joined source with no match, such as Research, are only known once the first source has been searched, so they are given last. A right or full join must be the last join line.

Joining a Bracketed Query

Either source can be a bracketed query, such as a grouped summary. This compares each team’s stated size with the number of people listed in it:

from Teams
join (
  from People
  group by team
  select team, count() as listed
) as p on team = p.team
sort by team
select team, members, p.listed as listed

A bracketed query in a join line needs an alias, here p.

A bracketed query in from must be searched before any of its rows can be joined, so its results don’t appear as the search runs. All of the outer where is then tested on the joined rows, so to narrow a source’s search, put the condition inside a bracketed query for it.

A bracketed query can’t have joins, an alias or a bracketed query of its own.

Several Joins

A query can have several join lines. Each is joined in turn, and a later join’s keys can use an earlier join’s fields, e.g.

from "Windows events"
join "HR Users" as hr on UserId = hr.Username
left join "Cost Centres" as cc on hr.Department = cc.Department
select UserId, hr.Department, cc.CostCentre

Keys

A join can have several keys, joined by and, and either side of a key can be an expression:

from "Windows events"
join "HR Users" as hr on lowerCase(UserId) = hr.Username and Host = hr.Host
select UserId, Host, hr.Department

Keys match exactly, as text, so case matters. Use a function such as lowerCase() on both sides to ignore case. A blank key never matches.

Dates match exactly too, so they must be the same time, e.g. the same day with no time of day. The example pack joins the start dates in People to the dates in the Bank Holidays Excel Data Connection:

from People
join "Bank Holidays" as h on started = h.date
sort by started
select name, started, h.holiday as holiday

Joining Events Within a Time Window

A join can also match events to events that happen within a time window of them. This finds each logon that was followed by a file export by the same user within 10 minutes:

from "Windows events" as logon
join "File events" as export
  on logon.UserId = export.UserId
  within 10m after logon.EventTime
where logon.EventType = "Logon"
select logon.UserId, logon.EventTime, export.FileName

within 10m after matches joined events from the first source’s time to 10 minutes after it, and within 10m before matches those from 10 minutes before it to that time. The joined event’s time is taken from its data source’s time field.

A join with a time window works the other way round from other joins. The first source is searched first and held, with the same limits as a joined source, so keep it small with where or a short time range. The joined source is then searched only within the windows of its rows, and no more of its events than the row limit may fall within them. The rows appear once both have been searched.

A query with a time window can have only one join line, and both sources must be data sources, not bracketed queries.

Where

where can name joined fields as well as those of the first source. Stroom splits it at its top level and:

  • Conditions on the first source’s fields narrow the first source’s search, as without a join.
  • Conditions on only one joined source’s fields narrow that source’s search, for a join or semi join.
  • Everything else, including an or that names fields of more than one source, is tested on the joined rows.

With a right or full join, where is tested on the joined rows, as in SQL, so it doesn’t narrow the first source’s search. To narrow it, use a bracketed query in from.

When the first source is a bracketed query, all of where is tested on the joined rows.

The query’s time range applies to every source whose data source has a time field, including joined sources and bracketed queries.

A semi or anti join adds no fields, so its fields can only be used in its keys, or, for a semi join, in where conditions on only its fields. To match only some rows of an anti join’s source, filter them in a bracketed query, e.g.

from People
anti join (from Teams where on_call = true select team) as t on team = t.team
select name, team

Performance and Limits

The joined source is held while the first source is searched, up to 1,000,000 rows or 256 MB. With a time window, the first source is held instead, with the same limits. A query that joins more fails, suggesting that the joined source is filtered or grouped. Administrators can change these limits with the search.resultStore.joinMaxRows and search.resultStore.joinMaxSize properties.

To keep joins fast:

  • Make the joined source small, by filtering it in where for a join or semi join, or by joining a bracketed query that filters or groups it.
  • Join a large source to a small one, not the other way round. Without a time window, the first source can be as large as any other search.
  • Join on one plain field of the first source, such as UserId, rather than an expression, where you can. A join, semi join or right join with one such key, on an ID, number, keyword or text field the first source can search, then also narrows the first source’s search to the joined source’s keys, if there are at most 1,000 of them and none has spaces, commas, quotes or wildcards. An anti join does the same, leaving those keys out, on ID and whole-number fields.

Each source is searched as the user running the query, so a join never shows data the user could not otherwise see.

The hidden StreamId, EventId and AnnotationId fields come from the first source, so a joined row still opens and annotates the first source’s event.

Warnings

A query with a join may give these warnings with its results:

  • A row matched many rows of a joined source, more than 1,000, so the result may be much bigger than expected. Check the keys of the join.
  • A field that where tests after a right or full join had no value in any row of the first source. This happens when a data source can search a field but not give its value. Narrow the first source with a bracketed query in from instead.
  • The rows of a right or full join with no match were left out, as the search didn’t finish.

Where Joins Can be Used

Joins can be used in a Query , in an Embedded Query panel on a Dashboard , and in scheduled analytic rules and reports.

Streaming and table builder analytic rules can’t use joins, an alias or a bracketed query in from, as they run on one event at a time as it is processed. Use a scheduled query rule instead.

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 Feed 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. Most rules.
Streaming Against each Stream 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.

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.

Streaming

A Streaming rule is run by a Processor filter , 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.

Table Builder

Table Builder is an experimental feature and should not be used.

Anatomy of a Rule

The tabs shown on an Analytic Rule depend on its processing type.

Tab Shown for Purpose
Query All The query that defines the rule, see Query.
Settings All What the rule declares about itself, and where its errors go, see Settings.
Notifications All Where detections are delivered, see Notifications.
Execution All Processing type, and the schedules for a Scheduled Query rule, see Execution.
Shards Table Builder only The data held in the rule’s table, see Table Builder Rules.
Duplicate Management Scheduled Query only Suppression of repeated detections, see Duplicate Management.
Documentation All Markdown 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.

Configuration

Some rule behaviour is set by system properties rather than on the rule itself.

Property Purpose
stroom.analytics.timezone The time zone used when generating detections.
stroom.analytics.executionHistoryRetention How long execution history is kept.
stroom.analytics.emailConfig The SMTP server used for email notifications, see Notifications.
stroom.analytics.duplicateCheckStore The store behind Duplicate Management.
stroom.ui.analyticUiDefaultConfig The defaults offered in the UI for processing node, error feed and destination feed.

4.1 - Rule Queries

The query that defines what an Analytic Rule detects, and how its columns become the content of a detection.

The Query tab holds the StroomQl 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.

Choosing a Data Source

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 Searchables 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.

Time Ranges and Relative Times

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.

Time Windows

A query with a window clause gives a row for each window of time, such as a count for each user for each day. A rule judges a window only when it has all of the window’s events, so that a window is judged once and is not judged on part of its events.

A Scheduled Query rule judges each window once, in the run whose time range holds the end of the window. A row that uses lead() is judged in the run whose time range holds the end of the last window it reads. Where the query gives no end to its time range, the range ends at the effective execution time.

The rule searches back before the start of its time range as far as it needs to, for the start of the first window it judges and for the windows that it reads with lag(). For example, a rule run once a day with windows of a day, a time range from day() - 1d to day() and lag(count(), 1) judges yesterday, and searches the day before as well so that it can compare the two.

Give each run a time range that follows on from the last one, so that every window ends in one of them. The range does not need to line up with the windows: a range from now() - 1d to now() judges each day in the run after it ends.

The search back applies to the whole query, including any join, so a joined data source is searched over the same longer range. A limit in the query applies to the windows the rule judges, and not to the windows it searches only for lag().

Columns

The columns your query selects become the content of each detection. Columns that Stroom adds for its own use, such as the ones behind a having expression or a window, are not added.

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 Event that caused it. Without them the detection still carries all its other values, but there is nothing to click through to.

Table Preferences

Some things about a result table cannot be expressed in StroomQl , 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.

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.

Feed for Errors

Field Description
Feed For Errors The Feed that errors occurring during execution are written to. Use Set Default to use the feed configured for the system.

Reports

A Report has a Settings tab of its own, holding Feed For Errors along with the settings that decide what kind of file it produces.

A report has no Level, Status or Include Rule Documentation, because it delivers a file rather than detections.

4.3 - Rule Execution

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.
Schedule A frequency or Cron 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.
Run As User The User 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.

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.

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.

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.

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.

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 Feed as XML conforming to the detection:1 XML Schema . 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.

Email Destinations

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.

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.

Testing

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.

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.

Detections written to a Feed 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.

How a Detection is Built

Most of a detection is filled in for you from the rule and from the run that raised it.

Field Where it comes from
detectTime When the detection was raised.
detectorName The name of the Analytic Rule .
detectorUuid The UUID 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.
detectionUniqueId A generated UUID , different for every detection.
detectionRevision Always 0 for detections raised by a rule.
executionSchedule The name of the execution schedule that fired, for a scheduled rule.
executionTime The wall clock time at which the rule ran.
effectiveExecutionTime The point in time the run represented.
values One entry per column in the query, see below.
linkedEvents 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.

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 Stream and Event the detection relates to. A detection whose query selects neither will have no linked events.

Fields a Rule Does Not Set

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.

Detections as a Data Source

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.

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.

4.7 - Streaming Rules

Rules that run against streams as they are processed rather than on a schedule.

A Streaming rule is run by a Processor filter rather than by a schedule. Each Stream 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.

Processing

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.

Differences from a Scheduled Rule

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.

It also has no Duplicate Management tab, so repeated detections must be controlled by limiting notifications instead.

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.

4.8 - Table Builder Rules

An experimental processing type that should not be used.

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.

Time Windows

A rule whose query has a window clause judges a window once it is closed, which is when the rule has read an event later than the end of the window, less the Aggregation Period. The last window is therefore not judged until a later event arrives. A window’s data is kept in the table until the window has been judged, even if that is longer than Time To Keep Data In The Table.

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 Feed 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.
Settings Reports only, see Report Settings.
Notifications The same destinations, but they deliver a file rather than a detection, see Delivery.
Execution Identical, see Execution.
Documentation 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.

Jobs

Reports are run by the Reports job, which is disabled by default. A report will not run until that job has been enabled in

Monitoring
Jobs
.

The job controls how often Stroom looks for report schedules that are due, not how often a report is produced.

Configuration

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.

File Type

Field Description
File Type The format of the file the report produces.

Four formats are available.

Format Notes
CSV 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 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.

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.

Feed for Errors

Field Description
Feed For Errors The Feed that errors occurring during execution are written to. Use Set Default to use the feed configured for the system.

5.2 - Report Delivery

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.

Feed Delivery

A Stream notification writes the report into a Feed 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 Metadata .

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.

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.

6 - Search Extraction

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.

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:

TODO: Fix image