pub struct MappingSet {
pub name: String,
pub version: u32,
pub mappings: Vec<SourceMapping>,
}Expand description
A versioned collection of mappings, loaded from one file.
Fields§
§name: StringIdentifies the set, such as sigma-windows.
version: u32Incremented on every change. Alerts record it, so a mapping fix can be traced to the detections it affected.
mappings: Vec<SourceMapping>The entries, each selecting rules by log source.
Implementations§
Source§impl MappingSet
impl MappingSet
Sourcepub fn from_yaml(source: &str) -> Result<Self, MappingError>
pub fn from_yaml(source: &str) -> Result<Self, MappingError>
Parses and checks a mapping set.
§Errors
Returns MappingError if the YAML is malformed or unsafe, if an entry
selects nothing or maps a field to no path, if two entries have the
same selector, or if an entry with a class_uid names a class, path,
or value the OCSF schema does not have.
Sourcepub fn select(
&self,
logsource: &LogSourceSelector,
) -> Result<&SourceMapping, MappingError>
pub fn select( &self, logsource: &LogSourceSelector, ) -> Result<&SourceMapping, MappingError>
Chooses the entry for a rule declaring logsource.
The most specific selecting entry wins, so a service: sysmon entry can
refine a general product: windows one.
§Errors
Returns MappingError::NoMapping if nothing selects the log source,
and MappingError::Ambiguous if two equally specific entries do.