Add Sigma correlation rule support to the LogScale backend#24
Open
nephalemsec wants to merge 1 commit into
Open
Add Sigma correlation rule support to the LogScale backend#24nephalemsec wants to merge 1 commit into
nephalemsec wants to merge 1 commit into
Conversation
Correlation rules previously raised an error because the backend declared
no correlation methods. They now convert to CQL:
- event_count and value_count
- value_sum, value_avg, value_percentile and value_median
- temporal, including boolean conditions (e.g. rule_a and rule_b)
Aggregation uses bucket(), event typing for temporal rules uses case{},
and the threshold filter uses test(). Field aliases are normalised so
group-by works across rules with different field names. temporal_ordered
is not supported and raises NotImplementedError.
Bumps the minimum pysigma to 1.2.0, which is where extended temporal
condition support was added.
007efbd to
be4e91d
Compare
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.
This adds Sigma correlation rule support to the LogScale backend. Correlation rules currently raise an error because the backend does not declare any correlation methods; with this change they convert to CrowdStrike Query Language.
Supported types
event_count,value_countvalue_sum,value_avg,value_percentile,value_mediantemporal, including boolean/extended conditions such asrule_a and rule_b and not rule_cApproach
The conversion follows the same search / aggregate / condition phase model as the Splunk backend, expressed with native CQL:
bucket(span=..., field=[...], function=...)for the time-windowed aggregation, withlimit=maxso group-by results are not capped at the default of 10 seriescase { ... | event_type := "<rule>" }to tag events by their originating rule for temporal correlations, thencount(field=event_type, distinct=true)to count how many referenced rules fired per grouptest(...)for the threshold filtercollect()the fired rules per group and test membership witharray:contains()Field aliases are normalised with
| <alias> := <field>so group-by works across rules that use different field names. The referenced rules are used as subqueries and are not emitted separately, matching the existing backend behaviour.temporal_orderedis not implemented: LogScale has no ordered-sequence primitive that fits the template model, so it raisesNotImplementedErrorwith a clear message rather than emitting an incorrect query.Example
An
event_countrule:converts to:
Testing
Adds
tests/test_backend_logscale_correlation.pycovering each correlation type, all condition operators, field aliases, timespan units, deferred sub-rules, boolean condition grouping and the unsupported paths. The full test suite passes and the backend module is at 100% coverage.See the Sigma correlation rules specification for the rule format.