Repository navigation
Conversation
The stats correlation method buckets events with `bin _time span=`, so the correlation timespan is a fixed window. Events that belong together but fall into two adjacent buckets are never correlated, e.g. a 4625 at 10:04:59 and a 4624 at 10:05:01 with `timespan: 5m`. The Sigma correlation specification describes a sliding window and lists static time boundaries as a restriction that causes false negatives. Add a second correlation method, `streamstats`, that sorts the events by time and aggregates them with `streamstats time_window=<timespan>` for event_count, value_count, temporal and extended temporal correlations. `stats` stays the default, so the default output does not change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF
| bin _time span=<timespan> | stats ... by _time ..., so the timespan is a fixed bucket. Events that belong together but fall into two adjacent buckets are never correlated.timespan: 5mproduce no alert, and neither do 10 events in 10 seconds around 10:45:00 withgte: 10. The Sigma correlation specification describes a sliding window and lists static time boundaries as a restriction that causes false negatives.streamstats(| sort 0 _time | streamstats time_window=<timespan> ...), forevent_count,value_count,temporaland extendedtemporal.statsstays the default, so existing output does not change. Users opt in withcorrelation_method="streamstats"(sigma-cli:--correlation-method streamstats).Priority: medium
Details
The specification (
sigma-correlation-rules-specification.md, "Compatibility") lists "Temporal relationships are only recognized within static time boundaries ... This could cause false negatives" as a restriction that backends should warn about. Thetemporalsection says: "The time frame should not be restricted to boundaries if this is not required by the given backend." Splunk does not require it. The backend already has a commented-out second method ("transaction": "... sliding time window"), so this adds that second method withstreamstats, which is cheaper thantransaction.Generated SPL (temporal,
group-by: [user],timespan: 5m):Behaviour of the new method:
statsmethod returns one row per bucket.streamstats time_windowneeds time-ordered input. A plain search returns events in descending order, which would also work, but the order ofmultisearchoutput is not guaranteed. The templates therefore always sort with| sort 0 _time, so one template works for all correlation types.bin: withtime_window=6m, two events exactly 6 minutes apart are not in the same window.streamstatslimits a window tomax_stream_windowevents (limits.conf, default 10000).gt,gte) and positive rule references are evaluated exactly. Upper-bound conditions and negated references in extended temporal conditions are evaluated on the window that ends at each event. This is documented in the README.by <fields>only when group-by fields exist, so a correlation withoutgroup-bygives valid SPL.timespan: 1Mmaps totime_window=1mon, which Splunk accepts, as it does1w,1yand1d.Testing
New tests in
tests/test_backend_splunk_correlations.py:test_correlation_methods_default_is_statsgroup-byfieldscontext (values()output)|reexpressionLive validation on Splunk Enterprise 10.4.3 (container). The events were ingested through
/services/receivers/simple, and the queries were converted by this branch with both methods,timespan: 5m:statsstreamstatsevent_type_count=2)failed_logon and success_logon)gte: 10, host h2event_count=10)gte: 3, host h3value_count=3)The steps from
.github/workflows/test.ymlwere run locally withpoetry install(the locked pySigma 1.2.0):pytest --cov=sigma: 159 passed on Python 3.10, 3.11, 3.12 and 3.13.🤖 Generated with Claude Code