Correlation Rules

Correlation Rules

A detection rule matches one event at a time. A correlation rule matches a pattern across many events: it watches the matches of the rules it references and fires when those matches, grouped by shared field values, satisfy a condition within a time window. Five failed logins for one user in five minutes, one source touching twenty distinct hosts in an hour, and reconnaissance followed by exfiltration from the same machine are all correlations.

RSigma implements all eight correlation types from the Sigma correlation specification. Both engine eval and the daemon evaluate them statefully. The PostgreSQL backend converts every type to SQL, and the Fibratus backend converts the ones it can express as event sequences.

Anatomy of a correlation

A correlation lives in its own YAML document next to the rules it references. This one fires when a single user fails to log in five times within five minutes:

title: Failed login
name: failed_login
logsource:
    category: authentication
detection:
    selection:
        EventType: failed_login
    condition: selection
---
title: Brute force against one account
correlation:
    type: event_count
    rules:
        - failed_login
    group-by:
        - User
    timespan: 5m
    condition:
        gte: 5
level: high
Key Meaning
correlation.type One of the eight types.
correlation.rules The rules whose matches feed this correlation, by id or name. They can be detection rules or other correlations (see Chaining correlations).
correlation.group-by Fields that partition matches into independent groups, each with its own window and count. Optional; without it, every match shares one group.
correlation.timespan Window length: a whole number followed by s, m, h, d, w, M (month), or y, such as 30s, 5m, or 1h. Must be greater than zero. timeframe is accepted as a synonym.
correlation.condition When to fire. A mapping of gt, gte, lt, lte, eq, and neq with whole-number thresholds; combine operators for a range (gt: 10 with lte: 50). The value types also need field, and the temporal types accept a boolean expression instead.
correlation.aliases Maps one group-by name to a different field in each referenced rule (see Aliases).
generate Top-level boolean. When true, the referenced rules also produce their own results (see What a correlation emits).

An event only counts toward a correlation if it carries every group-by field with a scalar value. An event where any of them is absent or null is skipped, a common reason for a correlation that never fires. Group-by fields are read after processing pipelines have renamed them, so use the post-pipeline names.

The eight correlation types

Each type computes one number per group and window, the aggregated_value in the output, and compares it against condition.

Type Aggregated value Needs field Typical use
event_count Number of matching events. no Brute force, alert storms, repeated failures
value_count Number of distinct values of field. A list of fields counts distinct combinations. yes One source scanning many ports or hosts, one user on many machines
value_sum Sum of field. yes Bytes transferred, records exported
value_avg Mean of field. yes Average request size or session length
value_percentile Value of field at percentile (0 to 100, default 50), by linear interpolation. yes Tail latency, unusually large transfers
value_median Median of field. yes Typical size or duration, robust to outliers
temporal Number of distinct referenced rules that matched. Fires when all of them did, unless condition says otherwise. no Several techniques from one host in a short span
temporal_ordered Same as temporal, but the rules must match in the order listed in rules. no Attack chains: access, then escalation, then exfiltration

The four numeric types read field as a number. Integers, floats, and numeric strings such as "4096" count; any other value is skipped. They take a single field; a list of fields is rejected when the rules load. NaN and infinity are skipped too, including text such as "NaN", "inf", or "1e999" and a chained child’s group-key value, so one such value cannot decide a window’s sum or average. Added in v0.29.0

A window that no event has added a value to never fires, whatever the condition. An event that matches a referenced rule but lacks field, or carries a non-numeric value for a numeric type, adds nothing, so a correlation with only an upper bound such as lt: 3 fires once at least one event in the window carried the field, not on events that never had it. Added in v0.29.0

Counting distinct values

value_count counts how many different values a field takes. This one fires when a single source connects to more than twenty distinct destination ports within ten minutes:

title: Port scan from one source
correlation:
    type: value_count
    rules:
        - network_connection
    group-by:
        - SourceIp
    timespan: 10m
    condition:
        field: DestinationPort
        gt: 20

Aggregating numeric values

value_sum, value_avg, value_percentile, and value_median aggregate a numeric field. This fires when one user downloads more than 500 MB in an hour:

title: Bulk download by one user
correlation:
    type: value_sum
    rules:
        - file_download
    group-by:
        - User
    timespan: 1h
    condition:
        field: BytesTransferred
        gt: 500000000

For a percentile, add percentile to the condition: field: Duration, percentile: 95, gt: 3000 fires when the 95th percentile of Duration in the window exceeds 3000.

Temporal proximity and order

temporal fires when the referenced rules all match within the window for the same group, in any order. temporal_ordered additionally requires them to match in the order of rules:

title: Discovery followed by exfiltration
correlation:
    type: temporal_ordered
    rules:
        - recon_whoami
        - archive_created
        - large_upload
    group-by:
        - Host
    timespan: 30m

Without a condition, both types require every distinct rule in rules. A threshold such as gte: 2 fires once any two of them have matched. A string condition is a boolean expression over the rule names in rules:

correlation:
    type: temporal
    rules:
        - recon_whoami
        - exfil_http
        - exfil_dns
    group-by:
        - Host
    timespan: 30m
    condition: recon_whoami and (exfil_http or exfil_dns)

A string condition may use not. Negating a rule reference means the correlation fires when that rule did not match in the window; the engine evaluates it at a deadline instead of the moment the positive rule matches. correlation.rules may be omitted for a string condition, in which case the references are taken from the condition in order of first appearance. Every name in the condition must appear in rules:; a missing name is a parse error, and a listed rule the condition never uses is a lint warning. Added in v0.29.0

Missing events and silent entities

A negated rule reference expresses “A without B within T”, and a condition made only of one negated rule expresses a deadman alert, “no heartbeat from this entity for T”. Both are RSigma extensions evaluated by the engine at an event-time deadline. The PostgreSQL and Fibratus backends reject them.

title: Login without MFA
name: login_without_mfa
correlation:
    type: temporal_ordered
    rules:
        - login_success
        - mfa_success
    group-by:
        - user.name
    timespan: 5m
    condition: login_success and not mfa_success
rsigma.absence_grace: 30s
title: Host stopped sending heartbeats
correlation:
    type: temporal
    group-by:
        - host.id
    timespan: 10m
    condition: not host_heartbeat     # rules omitted: derived as [host_heartbeat]

For temporal, the obligation opens when the positive rules match and the negated rules are absent. A negated hit cancels the obligation only when its timestamp falls in [s_max - T, s_min + T], the times that could share one timespan window with every positive hit, so a B shortly before A counts. For temporal_ordered, the interval is [s_min + 1, s_min + T], so only a B after the sequence starts counts; a B before A does not cancel it. The deadline is s_min + T, and rsigma.absence_grace delays firing past it.

A tumbling window opens one obligation per bucket, keyed by the bucket start b, with deadline b + T - 1. A negated hit cancels every pending obligation of its group whose interval contains its timestamp, including obligations of earlier tumbling buckets that have not fired yet. Every positive event opens its own obligation, so a negated hit cancels only the obligations whose interval contains it. With a 5m temporal_ordered window, A at 0m, B at 1m, and A at 4m with no later B still alerts for the second A. Under temporal, the B at 1m is within 5m of both A events, so it covers both and nothing fires.

The deadman form requires exactly one negated rule, a non-empty group-by, type: temporal, and a sliding window. A heartbeat arms the entity to last + T, a later heartbeat slides that deadline, and the alert fires once when the event-time clock passes the deadline plus grace. Entities are tracked after their first heartbeat only.

An absence correlation is rejected when a negation appears under or (a or not b, or not (b and d)), when a selector (1 of ..., all of ...) appears, when a rule is used both positively and negated, when the window is session, or when a temporal_ordered positive part is not a conjunction of rules. An empty positive part is the deadman form and follows the restrictions above.

An absence result carries an absence object with the missing rule references, the interval start, and the deadline:

{
  "rule_title": "Login without MFA",
  "correlation_type": "temporal_ordered",
  "group_key": [["user.name", "alice"]],
  "aggregated_value": 1.0,
  "timespan_secs": 300,
  "absence": { "missing": ["mfa_success"], "window_start": 1735689600, "deadline": 1735689900 }
}

Pending obligations and armed deadmen keep their deadlines across a state restore and a rule reload, however long the timespan; only one opened by a hit further ahead of the wall clock than max_future_skew is dropped. Added in v0.29.0

Delayed, lagging, and out-of-order input, retraction, and maintenance windows are covered in Late and delayed events.

Aliases

Referenced rules do not always name the same thing the same way. A process event might call the host Computer while a network event calls it hostname. An alias gives the group-by a single name and maps it to the right field in each rule:

title: Suspicious process then outbound connection
correlation:
    type: temporal
    rules:
        - suspicious_process
        - outbound_connection
    group-by:
        - host
    timespan: 5m
    aliases:
        host:
            suspicious_process: Computer
            outbound_connection: hostname

group-by lists the alias name, and each alias entry maps a rule reference from rules to the field to read from that rule’s events. The output’s group_key uses the alias name.

Time windows

Correlation windows use the time recorded in each event, so a delayed or replayed event lands where it happened. The engine reads the timestamp from the first of @timestamp, timestamp, syslog.timestamp, EventTime, TimeCreated, and eventTime that is present. Put your own field first with --timestamp-field or the rsigma.timestamp_field custom attribute. When an event has no parseable timestamp, the daemon uses the wall clock by default; pass --timestamp-fallback skip when replaying historical data so those events stay out of correlation state. Input Formats lists the timestamp formats the engine recognizes.

An event cannot have happened in the future, so a timestamp ahead of the wall clock is clock skew or bad data. A timestamp more than --max-future-skew ahead (default 5m) keeps the event out of correlation state, while detections still fire; the daemon counts it in rsigma_correlation_future_events_skipped_total. A smaller lead is clamped to the wall clock. This keeps one bad timestamp from holding a window, session, or suppression open. Added in v0.29.0

By default the window slides: each match is compared against the matches within timespan before it, so two events correlate whenever they are close enough together, regardless of clock boundaries. RSigma also offers tumbling windows (fixed, boundary-aligned buckets) and session windows (open while matches keep arriving within a gap, capped at timespan), set with rsigma.window and rsigma.gap:

title: Slow credential stuffing
correlation:
    type: event_count
    rules:
        - failed_login
    group-by:
        - SourceIp
    timespan: 6h
    condition:
        gte: 50
rsigma.window: session
rsigma.gap: 10m

The two attributes can sit at the top level, as here, or inside the custom_attributes: block, which wins when both appear. Added in v0.29.0 correlation.window and correlation.gap are accepted as aliases. Because the window is a custom attribute, a pipeline’s set_custom_attribute or a ruleset overlay can change it without editing the rule file. When such an override switches a session window to sliding or tumbling, the rule’s gap is dropped. Switching to session needs a gap, so set rsigma.gap alongside rsigma.window unless the rule already has one.

Window modes are an RSigma extension. A proposal to add them to the Sigma specification was declined because the specification deliberately leaves the windowing strategy to each backend, so rules that use them are not portable to other Sigma tools. Streaming Detection describes each mode’s semantics and out-of-order handling. For conversion, the PostgreSQL backend renders each mode and also lets you pick the strategy per conversion with -O correlation_method=, following pySigma’s model (see Rule Conversion).

Late and delayed events

Absence is decided on event time, not arrival time. Each tenant has one clock, the newest event timestamp the engine has seen, and the daemon also advances it while input is idle (see Absence correlations in the daemon). A negated hit cancels an obligation by its own timestamp, however late it arrives, as long as the obligation has not fired yet. A pipeline that delays every source by the same amount therefore only shifts the deadlines. Added in v0.29.0

A negated hit that arrives after the obligation fired cannot retract the alert unless rsigma.absence_retract is set (see Retracting a fired alert). A deadman heartbeat whose timestamp plus the timespan plus grace is already behind the clock is late too: it neither re-arms the entity nor slides its deadline. Both count in rsigma_correlation_absence_late_negatives_total, which is how to size rsigma.absence_grace. Grace delays firing without widening the interval in which a negated hit cancels. Added in v0.29.0 With rsigma.absence_max_lag set, a heartbeat is late only when that sum is more than the max lag behind the clock. Unreleased

Grace covers delays up to its own length. The settings below cover the delays it cannot, and all of them are off by default. Max lag and retraction are set per correlation, with a flag that sets the default for every absence correlation that does not set its own: Unreleased

Setting Rule attribute Flag Daemon config key
Max lag for a lagging source rsigma.absence_max_lag --absence-max-lag daemon.correlation.absence_max_lag
Retraction horizon rsigma.absence_retract --absence-retract daemon.correlation.absence_retract
Reorder window and its cap none --reorder-window, --max-reorder-events daemon.correlation.reorder_window, daemon.correlation.max_reorder_events
Maintenance file none --maintenance daemon.correlation.maintenance
Input stall limit none --stall-after (daemon only) daemon.stall_after

engine eval takes the same flags except --stall-after; the config keys apply to the daemon. This rule waits up to ten minutes for a lagging MFA source before it alerts, and keeps each alert retractable for an hour after its deadline:

title: Login without MFA
name: login_without_mfa
correlation:
    type: temporal_ordered
    rules:
        - login_success
        - mfa_success
    group-by:
        - user.name
    timespan: 5m
    condition: login_success and not mfa_success
rsigma.absence_grace: 30s
rsigma.absence_max_lag: 10m
rsigma.absence_retract: 1h

Sources that lag behind the others

Unreleased

A source is the log source of a detection rule: its product, category, and service after processing pipelines have run. With schema routing, each routed copy of a rule contributes the log source its pipeline produces. The negated rules of an absence correlation name the sources the missing event would arrive on.

With rsigma.absence_max_lag above zero, the engine keeps a clock per tenant for each of those sources: the newest timestamp of a detection hit on a rule with that source. With logsource routing on, every event whose extracted log source does not conflict with a source also moves that source’s clock, including events that match no rule; an event that asserts no product, category, or service conflicts with nothing and moves every source clock. Without logsource routing only matches move a source clock, so a source whose rules rarely match looks behind and holds deadlines for up to the max lag.

A due deadline then fires at whichever of two gates opens first:

  • The source gate opens when every negated source’s clock has passed the deadline plus grace. Each source that could carry the missing event has delivered something later, so the event is not coming.
  • The tenant gate opens when the tenant clock passes the deadline plus grace plus the max lag. It bounds how long a silent source can hold an alert.

When a negated reference is another correlation, which has no log source, or a negated source has delivered nothing yet for the tenant, only the tenant gate applies, so the alert fires one max lag after the deadline plus grace. A deadman uses the same gates over its heartbeat rule’s sources. The daemon’s idle advance moves only the tenant clock, so while input is idle a held deadline fires at the tenant gate. With a max lag of 0s, the default, the engine keeps no source clocks and a deadline fires as soon as the tenant clock passes the deadline plus grace.

Set the max lag to the largest delay you expect between the fastest and the slowest negated source. In the daemon, rsigma_correlation_absence_source_lag_seconds reports how far each source’s clock trails the tenant clock, labeled product/category/service.

Catching up after a backlog

Unreleased

A pipeline that stalls and recovers delivers a backlog of old events. In the daemon, --stall-after keeps the stall itself from firing every deadline: a watched tenant that delivers no input for that long produces one “Input stalled” result, and its absence clock stops at the limit until input resumes, so a whole-tenant silence does not fire one deadman per entity (see Absence correlations in the daemon).

When a positive hit from the backlog opens an obligation whose deadline plus grace is already behind the tenant clock, a correlation with a max lag holds the obligation instead of firing it, and counts it in rsigma_correlation_absence_held_total. A negated hit later in the backlog still cancels it by timestamp. Otherwise the source gate fires it once the negated sources pass its deadline plus grace, which is immediately when they already have, and the tenant gate fires it once the tenant clock passes its reading at the moment the obligation opened plus the max lag. Without a max lag, an overdue obligation fires as soon as it opens.

For example, take a 1m temporal correlation a and not b with a 10m max lag. Another source has moved the tenant clock to 12:00, while b’s source last delivered an event at 10:59. A backlogged a stamped 11:00 opens an obligation with deadline 11:01 and is held. A backlogged b stamped 11:00:30 cancels it. If no such b arrives, the obligation fires as soon as b’s source delivers an event stamped after 11:01, or at the latest when the tenant clock passes 12:10.

engine eval fires every obligation still pending at the end of the input, whichever gate it was waiting for (see Correlation in eval mode).

Retracting a fired alert

Unreleased

Set rsigma.absence_retract to a horizon to let a late negated hit withdraw an alert that already fired. The engine keeps a record of each emitted absence alert of that correlation until the tenant clock passes the alert’s deadline plus grace plus the horizon. A negated hit whose timestamp falls in the interval in which it would have cancelled the obligation, or after the last heartbeat and by the deadline for a deadman, removes the record and emits one result with absence.status: retracted. Each alert is therefore retracted at most once, and a hit that covers several fired alerts of its group retracts each of them.

The retraction carries the alert’s rule, group key, window_start, and deadline, with an aggregated_value of 0. In full or refs event mode, the late event is its only evidence:

{
  "rule_title": "Login without MFA",
  "correlation_type": "temporal_ordered",
  "group_key": [["user.name", "alice"]],
  "aggregated_value": 0.0,
  "timespan_secs": 300,
  "absence": { "missing": ["mfa_success"], "window_start": 1735689600, "deadline": 1735689900, "status": "retracted" }
}

A retraction bypasses rsigma.suppress and does not restart it, and the fired records survive rsigma.action: reset. Only an emitted alert is recorded, so an alert that suppression dropped has nothing to retract. Each group keeps at most rsigma.max_group_entries fired records (1,000 when unset), dropping the oldest first. A late heartbeat retracts a fired deadman the same way and re-arms the entity with a deadline of the heartbeat’s timestamp plus the timespan, unless that deadline plus grace is already more than the max lag behind the clock.

Downstream, the alert pipeline resolves the dedup alert and shrinks or resolves the incident, risk-based alerting subtracts the risk the alert added, and webhooks can route retractions with scope.absence_status. Retractions count in rsigma_correlation_absence_retracted_total, and each retracted alert also counts in rsigma_correlation_absence_late_negatives_total.

Retractions in correlation chains

Unreleased

A retraction withdraws the child alert from every parent that consumed it (see Chaining correlations), up to the ten-level chain limit:

  • A parent that is not an absence correlation loses the child’s hit from its window, so the hit no longer counts toward a later firing. An alert the parent already emitted stands.
  • An absence parent that uses the child positively drops the pending obligations that only that hit satisfied. When the parent has rsigma.absence_retract too, its fired alerts that depended on the hit are retracted as well, and the retraction continues to its own parents.
  • An absence parent that negates the child gets back the obligations the child’s alert cancelled, unless another negated hit still covers them, and a restored obligation that is already due fires at once. The parent keeps a record of those cancellations only when the child has rsigma.absence_retract. Restorations count in rsigma_correlation_absence_restored_total.

Out-of-order input

Unreleased

Without a reorder window, correlation applies events in arrival order and handles a late event per group, as Window modes describes. --reorder-window adds a buffer in front of correlation. Each tenant gets a watermark, its newest event time minus the window. An event’s correlation input is held until the watermark passes its timestamp and is then applied in timestamp order, ties in arrival order, so events that arrive up to one window out of order reach correlation sorted. Detections are emitted at once; only correlation input waits.

An event already behind the watermark is applied at once and counted in rsigma_correlation_reorder_late_total. An event without a timestamp of its own, which takes the wall-clock fallback, and an event that feeds no correlation are never held. --max-reorder-events (default 100,000) caps held events across all tenants. At the cap, the incoming event’s tenant releases its oldest held event early and raises its watermark to that event’s timestamp, or applies the incoming event at once when it holds nothing; each counts in rsigma_correlation_reorder_forced_total.

The absence clock follows the watermark, so absence deadlines fire one reorder window later than without the buffer, and any correlation fires up to one window after the event that completes it. The daemon’s idle tick also advances the watermark, so held events do not wait for the next batch, and engine eval applies every held event at the end of the input before it finalizes.

Planned maintenance

Unreleased

A maintenance window mutes correlations during planned work. Windows come from a maintenance file, passed with --maintenance to engine eval or engine daemon, or from the daemon’s maintenance API and the create_maintenance_window MCP tool. The daemon re-reads the file on every reload and keeps the previous windows when the new file is invalid. Window times are compared with the tenant’s event-time clock, so a replay honors the windows of the period it replays.

A window matches a correlation when one of its rules names the correlation by id, name, or title, and every group pair is in the alert’s group key. An empty rules matches every correlation and an empty group matches every group, but a window must set at least one of the two. A window with a tenant applies only to that tenant; without one it applies to every tenant. What a match does depends on the correlation:

  • An absence obligation whose interval overlaps a window occurrence is dropped when it comes due instead of firing.
  • A deadman whose interval since the last heartbeat overlaps an occurrence is re-armed to the end of the occurrence plus the timespan, so the entity has a full window to report after the maintenance.
  • Any other correlation type is suppressed while the group’s newest event time is inside an occurrence. Its window keeps counting, so the next qualifying event after the occurrence fires as usual.

These outcomes count in rsigma_correlation_maintenance_total under the kind values obligation_dropped, deadman_extended, and correlation_suppressed.

A maintenance file lists its windows under windows:, each with a unique id. A one-off window needs starts_at and ends_at in RFC 3339. A recurring window has a schedule with a cron expression, a duration per occurrence, and an IANA timezone (UTC when unset); there, starts_at and ends_at are optional and bound the series. Recurring schedules need the maintenance-schedules feature of rsigma-eval, which the rsigma CLI enables by default.

max_maintenance_duration: 720h
max_maintenance_windows: 1000
windows:
    - id: db-patching
      rules: ["Host stopped sending heartbeats"]
      group:
          host.id: db-01
      starts_at: 2026-12-12T02:00:00Z
      ends_at: 2026-12-12T04:00:00Z
      comment: monthly patching
      created_by: ops
    - id: backup-logins
      tenant: acme
      rules: [login_without_mfa]
      group:
          user.name: svc-backup
      schedule:
          cron: "0 1 * * SUN"
          duration: 3h
          timezone: Europe/Berlin

A window’s rules and group must both match. db-patching mutes the heartbeat deadman for db-01 only, so other hosts and other correlations about db-01 still alert. backup-logins mutes login_without_mfa for the svc-backup account of tenant acme every Sunday from 01:00 to 04:00 Berlin time. max_maintenance_duration (default 720h; 0 lifts it) and max_maintenance_windows (default 1000) bound the windows created over the API, not the windows in the file.

To mute absence alerts during planned maintenance without changing the engine, a silence with a rule matcher and a correlation.group_key.<field> matcher still works. A silenced absence alert still fires in the engine and counts in rsigma_correlation_absence_fired_total; the alert pipeline drops it before the sinks. Added in v0.29.0

What a correlation emits

When a correlation fires, it emits one result for the group:

{
  "rule_title": "Brute force against one account",
  "rule_id": "...",
  "level": "high",
  "tags": [],
  "correlation_type": "event_count",
  "group_key": [["User", "admin"]],
  "aggregated_value": 5.0,
  "timespan_secs": 300
}

The detections a correlation references feed its state but are not emitted on their own by default, so a brute-force correlation does not also print each failed login. Set top-level generate: true on the correlation to emit them as well, or pass --emit-detections to emit every detection match for that run.

To see which events made a correlation fire, set rsigma.correlation_event_mode on the rule (or --correlation-event-mode for every correlation) to full for the event bodies or refs for timestamps and IDs only. rsigma.max_correlation_events (default 10) caps how many are kept per window, evicting the oldest first. Evaluating Rules shows both modes, and Custom Attributes lists every per-rule key.

An absence result also carries the absence object shown in Missing events and silent entities. Its status field is left out on a fired alert and set on status results: retracted when a late negated hit withdraws a fired alert (see Retracting a fired alert), and stalled or resumed from the daemon’s input stall watch, which emits them under the rule id rsigma-input-stalled (see Absence correlations in the daemon). The correlation.absence.status selector of the alert pipeline and scope.absence_status in webhooks read it, and treat every correlation result without a status as fired. Unreleased

Chaining correlations

A correlation can reference other correlations in rules. This one fires when the brute-force correlation above fires twice for the same user within an hour:

title: Repeated brute force bursts
correlation:
    type: event_count
    rules:
        - brute_burst
    group-by:
        - User
    timespan: 1h
    condition:
        gte: 2

Here brute_burst is the name of the first correlation. Only the top of a chain produces output; the correlations below it update its state silently unless a referencing correlation has generate: true or --emit-detections is on. Chains can be up to ten levels deep, and cycles are rejected when the rules load. A parent in full or refs event mode carries the events its children kept when they fired.

A child passes on only its own group key, so a parent can read only the child’s group-by fields. Each of the parent’s group-by fields, read through the parent’s aliases for that child, must be in the child’s group-by. Added in v0.29.0

A value-aggregating parent (value_count, value_sum, value_avg, value_percentile, or value_median) takes the value of its field from each firing of the child, so field must be in the child’s group-by too. value_count counts the distinct values the child’s firings carry, and the numeric types aggregate one number per firing. This one fires when bursts of failed logins against one user come from three different source addresses within an hour: Added in v0.29.0

title: Brute force burst per source
name: burst_per_source
correlation:
    type: event_count
    rules:
        - failed_login
    group-by:
        - User
        - SourceIp
    timespan: 5m
    condition:
        gte: 5
---
title: Brute force bursts from several sources
correlation:
    type: value_count
    rules:
        - burst_per_source
    group-by:
        - User
    timespan: 1h
    condition:
        field: SourceIp
        gte: 3

A parent that needs a field its child does not group by is rejected when the rules load, and rule lint reports it as chained_correlation_field_missing, so the mismatch shows up before the rules are deployed. Added in v0.29.0

After a correlation fires

By default a correlation keeps its window after firing, so the next qualifying match fires again. Two settings change that:

  • Suppression drops repeat alerts for the same correlation and group key for the given duration. Set it with --suppress 5m, or with rsigma.suppress: 5m on the rule. The duration is measured on the group’s newest event time, so a late event cannot shorten it. Added in v0.29.0 For an absence result, suppression is measured on the deadline.
  • Reset clears the group’s window when the correlation fires, so the count starts again from zero. Set it with --action reset, or with rsigma.action: reset on the rule. The default action is alert. For an absence correlation, alert keeps the group’s other pending obligations and reset clears the group’s positive hits, latest negated hits, and every pending obligation after emitting.

The flags apply to every correlation, and a value on the rule overrides the flag for that rule.

title: Brute force against one account
correlation:
    type: event_count
    rules:
        - failed_login
    group-by:
        - User
    timespan: 5m
    condition:
        gte: 5
custom_attributes:
    rsigma.suppress: 30m
    rsigma.action: reset

A matching maintenance window drops an alert without recording it, so the dropped alert neither starts suppression nor resets the window. A retraction is not subject to either setting: it bypasses suppression, and the fired records it needs survive reset. Unreleased

State and memory

Correlation state is a window per correlation and group key. In engine eval it lives in memory for the length of the run. The daemon keeps it across restarts when you pass --state-db, which snapshots state to SQLite periodically and on shutdown (see State persistence).

Memory grows with the number of distinct group keys and with window length. --max-state-entries (default 100,000) caps the total number of groups across all correlations and evicts the stalest when reached; absence groups with a pending deadline do not count toward it. Added in v0.29.0 --max-group-entries or rsigma.max_group_entries caps how much a single group retains (default 10,000, raised for an event_count or value_count condition with a larger threshold). Absence correlations have their own caps: --max-absence-entries (default 100,000) bounds the number of absence groups with a pending obligation or an armed deadman, and a hit that would make a group pending at the cap is refused instead of evicting a pending deadline that fires sooner. It must not be larger than --max-state-entries; left at its default, it follows a lower --max-state-entries. Added in v0.29.0 Pending obligations per group default to 1,000 when neither --max-group-entries nor rsigma.max_group_entries is set. Added in v0.29.0 Performance Tuning covers sizing.

Late-event handling adds state of its own. With rsigma.absence_retract, each absence group keeps a record of every fired alert until its horizon passes, at most rsigma.max_group_entries of them (1,000 when unset), and an absence parent also records the obligations a retracting child cancelled. The reorder buffer holds full event bodies, up to --max-reorder-events (default 100,000) across all tenants, so size that cap by your event size. A max lag keeps one clock per tenant and negated source. With --state-db, the daemon saves fired records, held events in arrival order, source clocks, and the maintenance windows created over the API in its correlation snapshot, and restores them on restart. Unreleased

When several daemons share a NATS consumer group, each replica keeps its own state, so the events of one group key must reach the same replica to correlate. See consumer groups.

Testing and debugging correlations

  • Pipe a file of events through rsigma engine eval -r rules/ to check that a correlation fires. If it does not, add --dump-correlation-state to print each group’s current value, threshold, and window entries at the end of the run. An absence correlation fires at the end of the input when its deadline is reached, and the dump prints after that finalization. Added in v0.29.0 The dump also lists each tenant’s source clocks and reorder watermark and the loaded maintenance windows. Unreleased
  • Attach timestamped example events to the rule with rsigma.exemplars and run rule test. Correlation exemplars use an events list with relative offsets; see Custom Attributes. An absence exemplar fires at the end of the listed events when the missing rule never arrived.
  • rule backtest resets correlation state for each corpus file, so keep the events of one incident in one file.
  • rule lint checks correlation structure, such as a value type without field, a non-numeric threshold, a session window without gap, or a chained correlation that needs a field its child does not group by. It also reports an rsigma.absence_max_lag or rsigma.absence_retract value that is not a duration, and one set on a correlation that is not an absence correlation. Unreleased The lint rule reference lists every check.
  • rule draft --groups turns example incidents into per-step detections and a temporal or temporal_ordered correlation. It infers the group-by, order, and window, and embeds an exemplar that rule test can run.

Troubleshooting collects the common causes of a correlation that never fires.

See also