Repository navigation
Rule Conversion and Field Mapping
Last reviewed: 2026-11-28 (commands below run offline with sigma-cli 4.0.1 and pySigma 2.1.2; no SIEM executed the output)
Prerequisites: Detection Engineering index ยท Rule lifecycle ยท Detection content validation.
Sigma rules are converted into a SIEM query by a pySigma backend, and processing pipelines rename fields and add log-source conditions on the way. Most conversion bugs are field-mapping bugs that convert cleanly and then never match. This guide covers choosing backends and pipelines, the pitfalls, and how to check a converted query.
Lists the pinned toolchain, shows how pipelines change output, demonstrates a custom mapping pipeline and a strict-mapping guard, and gives a verification checklist for converted queries.
Every converted query is pinned to a toolchain version, compared with a golden output, and checked against the field names the target actually ingests.
- Converting a SigmaHQ or in-house rule for a SIEM.
- Upgrading sigma-cli, pySigma, a backend or a pipeline.
- A rule that passes
sigma checkbut never fires.
| Package | Version | Notes |
|---|---|---|
| sigma-cli | 4.0.1 | Requires Python >=3.11,<4.0 and pySigma >=2.0.0,<3.0.0 |
| pySigma | 2.1.2 | |
| pysigma-backend-splunk | 3.0.1 | Targets splunk and splunk_spl2; both require a processing pipeline |
| pysigma-pipeline-sysmon | 3.0.0 | Pipeline sysmon
|
| pysigma-pipeline-windows | 3.0.0 | Pipelines windows-logsources and windows-audit
|
sigma list pipelines with this set also lists splunk_windows, splunk_sysmon_acceleration and splunk_cim from the Splunk backend. pySigma-backend-elasticsearch 2.1.1 requires pySigma <2.0.0, so it cannot be installed alongside this set. Install with exact pins, as in the lab's requirements-lab.txt, rather than sigma plugin install, which fetches a plugin directory from GitHub and calls pip install at run time.
The lab rule proc_creation_win_pnwc_lab_canary.yml checks Image|endswith and CommandLine|contains. These outputs were observed:
sigma convert -t splunk -p sysmon -p splunk_windows proc_creation_win_pnwc_lab_canary.yml
# source="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 Image="*\\pnwc-lab-canary.exe" CommandLine="*PNWC-LAB-CANARY-7F3A*"
sigma convert -t splunk proc_creation_win_pnwc_lab_canary.yml
# exit 2: "Processing pipeline required by backend!"The sysmon pipeline adds the source and EventCode=1. Without a pipeline the Splunk backend refuses to convert. --without-pipeline overrides that refusal: the output was Image="*\\pnwc-lab-canary.exe" CommandLine="*PNWC-LAB-CANARY-7F3A*", with no source or EventCode condition and the Sigma field names unchanged.
When the SIEM uses a different schema, map fields in a pipeline file. Transformation type names come from sigma/processing/transformations/__init__.py in pySigma 2.1.2.
name: Lab field mapping example (strict)
priority: 30
transformations:
- id: lab_process_fields
type: field_name_mapping
mapping:
Image: process.executable
CommandLine: process.command_line
- id: lab_unmapped_fields_fail
type: strict_field_mapping_failuresigma convert -t splunk -p lab_field_mapping_strict.yml proc_creation_win_pnwc_lab_canary.yml
# process.executable="*\\pnwc-lab-canary.exe" process.command_line="*PNWC-LAB-CANARY-7F3A*"The strict_field_mapping_failure step makes conversion fail on any field the pipeline did not map. With a rule whose CommandLine was misspelled ComandLine, the strict pipeline exited 1 with The following fields are not mapped: ComandLine.
| Pitfall | What happened offline | Guard |
|---|---|---|
| Misspelled or unknown field | With -p sysmon -p splunk_windows, the ComandLine typo converted with exit 0 to ComandLine="*PNWC-LAB-CANARY-7F3A*". sigma check --fail-on-issues also passed it |
Strict mapping step; golden-output comparison; check the field exists in ingested events |
| Missing pipeline | Splunk backend exits 2 | Always pass -p; do not use --without-pipeline for production output |
| Pipeline order and priority | The pySigma resolver applies pipelines lowest priority first (sysmon 5, windows-logsources and windows-audit 10, splunk_windows and splunk_cim 20, splunk_sysmon_acceleration 25) |
Pin the exact -p list in the golden test |
| Vendor schema versus ingested data | The pipeline assumes source="WinEventLog:Microsoft-Windows-Sysmon/Operational"; your index or source name may differ |
Confirm with a real event from the target before deploying |
| Sigma field naming | The Sigma specification says to use the mapped name where a mapping exists, and otherwise the field as it appears in the log source with spaces removed | Review new fields against the spec's Field Usage rules |
| Meta filter semantics | A filter's condition is added to the rule as written (see below) |
Inspect the converted output after applying any filter |
The Sigma field rules are in the Sigma rules specification 2.1.0. This guide does not cover converting Sigma to Wazuh XML; Wazuh rules in this repository are written natively and tested through logtest.
sigma convert --filter <file> applies a Sigma meta filter to the rules named in its filter.rules list. With pySigma 2.1.2, the filter's condition was appended to the rule as written:
sigma convert -t splunk -p sysmon -p splunk_windows --filter mf_lab_canary_service_account.yml proc_creation_win_pnwc_lab_canary.yml
# condition: not selection โ ... CommandLine="*PNWC-LAB-CANARY-7F3A*" NOT User="LAB\\svc_canary*"
# condition: selection โ ... CommandLine="*PNWC-LAB-CANARY-7F3A*" User="LAB\\svc_canary*"The specification's example filter uses condition: selection for an exclusion. With this toolchain that narrows the rule to only the "excluded" events instead of removing them, so write not selection and check the output. The specification recommends the mf_ filename prefix. Filter files were written for this test only; none is committed.
- Run
sigma check --fail-on-issueson the rule. The defaultsigma checkexits 0 even with validation issues. - Convert with the exact pinned packages and
-plist, and compare the output byte for byte with a committed golden string, as the lab'ssigma-convert-splunkfixture does. - Add a strict field-mapping step, or grep the output for every field and confirm each one exists in ingested events from the target.
- Run the query in a non-production SIEM against a positive and a near-miss negative event. The canary lab does not do this step, so its Sigma evidence stops at conversion.
- On any toolchain upgrade, re-run the golden comparison and treat a changed query as a rule change that needs review.
- README.md - Detection Engineering index
- labs/wazuh-suricata/requirements-lab.txt - exact Sigma toolchain pins
- ../SIEM/detection-content-validation.md - upstream sources and promotion checklist
โฌ ๏ธ Detection Engineering index | Master Index | ๐ฏ Role Navigation | Legal Notice
๐ Source: IncidentResponse/DetectionEngineering/rule-conversion-and-field-mapping.md | โ๏ธ Suggest an edit | โฌ
๏ธ Back to Incident Response
- ๐บ๏ธ Browse by Topic
- ๐ All Repository Files
- ๐งญ Learning Paths
- ๐ Master Guide
- ๐ค Glossary
- โ๏ธ Legal & Disclaimer
๐ Foundations & Learning
๐ก๏ธ Defense & Investigations
- Incident Response
- Open Source Intelligence (OSINT)
- Reverse Engineering
- Operations Security (OPSEC)
- Compliance
โ๏ธ Platforms & Infrastructure
๐ก Hardware, Wireless & Field Projects
- PNWC Cyberdeck
- Hardware Testing
- Hardware Hacking
- Software-Defined Radio
- Wardriving
- uConsole
- Space Security
๐งฐ Assessment & Field Reference
๐ฆ Downloads & Project Resources
๐๏ธ Additional Topics