Rule Queries
The query that defines what an Analytic Rule detects, and how its columns become the content of a detection.
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
Feed
A rule is the combination of four things, each of which has its own tab on the rule.
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.
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
Stream
A Stream is the unit of data that Stroom works with and will typically contain many Events. Click to see more details... as it is processed. |
Rules that must alert as close to ingest as possible. |
| Table Builder | Experimental, see below. | Not for production use. |
Changing the processing type changes which tabs the rule shows, because some settings only apply to one type.
A Scheduled Query rule runs its query on a schedule, for example every hour or at 03:00 each day. Each run covers a window of data, and the rule keeps track of which windows it has already covered so that it can work through history without gaps or repeats.
This is the type to use for most rules. It is also the only type available to Reports.
A Streaming rule is run by a
Processor filter
Processor filter
Table Builder is an experimental feature and should not be used.
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
Markdown
Markdown is a simple markup language for creating rich formatted text using a text editor. Due to the simplicity of the Markdown it is still very readable in its raw form that contains the markup. Markdown is used in Stroom on the Documentation tab of each Document type and in the Documentation Document type. Click to see more details... describing the rule. |
| Permissions | All | Who can read and use the rule. |
The content of the Documentation tab is not just for readers.
It is also used as the detailedDescription of the detections the rule raises, so it is worth writing something that will make sense to whoever receives the detection.
This can be turned off per rule with Include Rule Documentation on the Settings tab.
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
.| 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.
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. |
The query that defines what an Analytic Rule detects, and how its columns become the content of a detection.
What a rule declares about itself, whether its documentation is included in detections, and where its errors go.
Execution schedules, how a scheduled rule works through time, and the history of what it has run.
Delivering detections to a feed or to people by email, and limiting how many notifications a rule can send.
What a detection contains, how it is built from the rule’s query, and the XML written to a feed.
Suppressing detections that repeat something you have already been told.
Rules that run against streams as they are processed rather than on a schedule.
An experimental processing type that should not be used.