Implement Sigma correlation rule matching with sliding-window engine#16
Draft
Implement Sigma correlation rule matching with sliding-window engine#16
Conversation
Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com> Agent-Logs-Url: https://github.com/SigmaHQ/sigma_engine/sessions/3b33176e-6be6-4dd8-b3cc-152e3e51c186
Copilot
AI
changed the title
[WIP] Implement matching of Sigma correlation rules with timestamp support
Implement Sigma correlation rule matching with sliding-window engine
Mar 23, 2026
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.
Adds full correlation rule evaluation to
LogProcessor, covering all seven Sigma v2.1.0 correlation types with per-group sliding time windows, field alias resolution, and late-event discarding.Breaking change
LogProcessor::start()now returns(Sender<LogEvent>, Receiver<DetectionResult>)instead ofReceiver<Detection>.DetectionResultis an enum:New types
DetectionResult— unified channel output (Rule|Correlation)CorrelationDetection— triggered correlation rule +group_key+contributing_eventsLogEventtimestamptimestamp: DateTime<Utc>field (defaults toUtc::now())get_time()accessor andwith_timestamp()builder for explicit controlCorrelation engine
Detections from the matcher pool and evaluates correlation state before forwarding to the output channel(rule_index, group_key)VecDeque-backed sliding window; evicts events outside the timespan on every new arrivalevent_count,value_count,temporal,temporal_ordered,value_sum,value_avg,value_percentilegroup_byfield names through thealiasesmap to the actual field name for the triggering ruleProcessorConfig::late_event_threshold_secs(default 3600 s) discards events arriving more than N seconds behind the most recent event in the windowNew constructors
LogProcessor::from_collection(&SigmaCollection)— loads detection rules and correlation rules in one callLogProcessor::with_correlation_rules(Vec<SigmaCorrelationRule>)— builder-style addition to an existing processorUtilities
parse_timespan(s: &str) -> Option<Duration>— parses Sigma timespan strings (1s,5m,1h,2d,1w)Original prompt
Start implementation
The user has attached the following file paths as relevant context:
- .github\copilot-instructions.md
[Chronological Review: The conversation began with the user requesting the implementation of matching Sigma correlation rules based on a specified GitHub document. The user provided a detailed description of the requirements, including the need for timestamps in events, modifications to the existing `#sym:Event` trait, and the use of a message passing system for correlation matching. The user also emphasized the need for efficient data structures and handling of late-arriving events. The conversation progressed with the user actively working on the `c:\Users\thoma\OneDrive\Devel\sigma_engine\src\processor.rs` file, focusing on implementing these features.][Intent Mapping: The user explicitly requested the following:
[Technical Inventory: The conversation involved the following technical concepts:
#sym:SigmaCorrelationRule: A struct representing a fully-parsed Sigma correlation rule.#sym:Eventtrait: Required modification to include a timestamp.#sym:impl LogProcessorto be utilized for correlation matching.[Code Archaeology: The user is currently working on the
processor.rsfile, which is likely to contain the implementation logic for the correlation rules and event processing. TheSigmaCorrelationRulestruct was previously defined intypes.rs, which includes various fields relevant to correlation rules.][Progress Assessment: The user has outlined the requirements for the correlation rule matching but has not yet implemented the changes. The focus is on defining the logic and data structures needed for the correlation matching process.]
[Context Validation: All critical information for continuation is captured, including the user's goals, the specific requirements for the implementation, and the current file being worked on.]
[Recent Commands Analysis: The last agent command was the user's request to implement the correlation rule matching, which included multiple specifications for functionality and structure. The immediate pre-summarization state involved the user actively working on the
processor.rsfile, detailing how to implement the correlation logic and event handling.]1. Conversation Overview: - Primary Objectives: The user requested to "Implement matching of Sigma correlation rules as defined in the specification..." and specified various requirements for timestamps, event handling, and correlation logic. - Session Context: The conversation focused on implementing features in the Sigma engine, particularly in the `processor.rs` file, to support correlation rules. - User Intent Evolution: The user's needs have remained consistent, focusing on implementing a robust correlation matching system with specific requirements for event handling and data structures.- Technical Foundation:
- Message passing system: To be utilized for correlation matching in
- UUIDs: To uniquely identify detections in the correlation process.
- Codebase Status:
- Purpose: Contains the implementation logic for processing events and correlation rules.
- Current State: The user is actively working on implementing the correlation matching logic.
- Key Code Segments: Not specified yet, as implementation is pending.
- Dependencies: Relies on the
- Problem Resolution:
- Issues Encountered: None explicitly mentioned, but challenges related to implementing the correlation logic and handling late events are anticipated.
- Solutions Implemented: No solutions have been implemented yet; the user is in the planning phase.
- Debugging Context: Ongoing development with no known issues reported.
- Lessons Learned: Insights will emerge as the implementation progresses.
- Progress Tracking:
- Completed Tasks: None yet; the user has outlined requirements but not implemented them.
- Partially Complete Work: The user is in the process of defining the correlation matching logic.
- Validated Outcomes: None yet, as testing will follow implementatio...
#sym:SigmaCorrelationRule: A struct for Sigma correlation rules, containing fields like title, id, description, and correlation details.#sym:Eventtrait: Needs modification to include aget_timefunction for timestamps.#sym:impl LogProcessor.processor.rs:#sym:SigmaCorrelationRulestruct and the message passing system.Created from VS Code.
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.