
Status: experimental, work in progress:
- Requires more testing
pySigma Databricks Backend
This is the Databricks backend for pySigma. It provides the package sigma.backends.databricks with the DatabricksBackend class.
Further, it contains the following processing pipelines in sigma.pipelines.databricks:
snake_case: convert column names into snake case format
See CHANGELOG.md for the changes in each release.
It supports the following output formats:
lakewatch: Lakewatch detection rules (Unity Catalog governed), batch by default;default: plain Databricks/Apache Spark SQL queries;dbsql: Databricks SQL queries with rules metadata (title, status) embedded as comment;detection_yaml: Yaml markup for my own detection framework.
Installation
pip install sigma-cli pySigma-backend-databricks
To deploy Lakewatch rules with lakewatch-rule-deploy, install the deploy extra as well (see
Deploying rules).
Documentation
The README covers what you need to get started. The details are in docs/:
| Document | Contents |
|---|---|
| Lakewatch rule output | Sigma metadata mapping, output files, target modes (workspace, content_pack), content-pack output, alert summaries and overrides |
| Parser discovery and conversion reports | Finding the parsers that fit your rules, and the conversion_report.yaml format |
| Built-in profiles | The profile of each supported parser, and its known limitations |
| Writing profiles | Profile format, VARIANT paths and named entries, value transforms, keyword search and routing, scaffolding scripts, validation against live data |
| Deploying rules | lakewatch-rule-deploy in detail: ownership, updates, output and exit codes |
| OCSF mode | Converting against OCSF gold tables, and how OCSF fields are rendered |
Lakewatch Output
Generate Lakewatch detection rules from Sigma rules (see the Lakewatch documentation). Each rule is a Unity Catalog governed resource. Rules are converted against the tables of Lakewatch parsers. A profile maps the Sigma fields of a logsource to the columns of one parser's table, and the backend ships a profile for each supported parser (see Built-in profiles). Converting against OCSF gold tables is optional (see OCSF mode).
Lakewatch quick start
-
Find the parsers that fit your rules. Without
-O parsers, nothing is converted. Instead, the backend reports which profiles can convert each rule, and suggests a-O parsers=...value:sigma convert -t databricks -f lakewatch rules/windows/
Pick the parsers whose data you ingest: the suggestion lists every profile that fits. See Parser discovery.
-
Convert the rules for the selected parsers.
-sskips the rules that fail, instead of stopping at the first error:sigma convert -s -t databricks -f lakewatch -O parsers=aws_cloudtrail \ -O table_name=main.sec.aws_cloudtrail -O catalog_name=main -O schema_name=sec \ -O warehouse_id=1234567890abcdef rules/ -o detections.yaml
With several parsers, give each its table with
table_map:sigma convert -s -t databricks -f lakewatch \ -O parsers=windows_sysmon_process,windows_security_process \ -O table_map=windows_sysmon_process:main.sec.sysmon,windows_security_process:main.sec.winsec \ -O catalog_name=main -O schema_name=sec -O warehouse_id=1234567890abcdef \ -O output_dir=detections rules/windows/
Each selected parser produces one rule per Sigma rule, named
<rule_name>__<profile>. Multiple rules are emitted as separate---documents in one file. With-O output_dir=<dir>, each rule is written to its own<dir>/<rule_name>.yaml, together with aconversion_report.yamlthat lists what converted, what failed and why (see Conversion report). Don't use the--output-dir/-odoption of sigma-cli: it writes only the bare SQL condition of each rule, not the rule documents. -
Review and deploy the rules (see Deploying rules). Converted rules are disabled by default, so they can be tested first.
Lakewatch options
Options are passed as -O key=value.
| Option | Default | Meaning |
|---|---|---|
parsers |
(none) | Comma-separated profile ids, for example aws_cloudtrail,okta_system_log. Without it, parser discovery runs instead of a conversion. |
table_name |
(none) | Table to read from. Use it when exactly one parser is selected. |
table_map |
(none) | profile:table,profile:table for several parsers. Every selected profile needs a table. |
catalog_name |
(required) | catalog_name of the rule, also used as batch.sql.default_catalog_name to resolve unqualified tables. Conversion fails if it's unset. |
schema_name |
(required) | schema_name of the rule, also used as batch.sql.default_schema_name. Conversion fails if it's unset. |
warehouse_id |
(required) | batch.warehouse_id: the SQL warehouse that runs the rule. Conversion fails if it's unset (the server rejects batch rules without one). |
schedule |
24h |
Rule schedule (Lakewatch duration). |
extend_lookback |
(none) | timerange.extend_lookback: widens the time window beyond the schedule. |
enabled |
false |
schedule.enabled. Set -O enabled=true to schedule the rules immediately. |
default_fidelity |
(from status) | Override the rule fidelity. Accepts both Investigative and FIDELITY_INVESTIGATIVE. |
default_category |
Static Signature |
Rule category. |
output_dir |
(none) | Write one file per rule, and conversion_report.yaml, into this directory. |
target |
workspace |
workspace creates rules for the Lakewatch API, content_pack the rule documents of a Lakewatch content pack (see Target modes). |
overrides |
(none) | YAML file with per-rule alert summary, context and select settings (see Alert summaries). |
lakewatch_profiles_dir |
(none) | Directory with your own *.yml profiles. They are added to the built-in ones, and an id replaces a built-in id (see Writing profiles). |
lakewatch_schemas |
(none) | JSON file with additional parser schemas, in the format of the bundled catalog. |
raw_log_field |
(none) | STRING column searched by keyword (unbound) searches, for every selected profile. |
prune_unsupported |
true |
Drop fields that a profile lists as unsupported where that only narrows the rule, and fail the rule otherwise. false fails every rule that uses one. |
Sigma metadata maps to the rule: title becomes the alert summary, description the description
and objective, level the severity, attack.* tags the MITRE entries, and falsepositives the
runbook. Sigma stable rules get FIDELITY_INVESTIGATIVE, and all others FIDELITY_DEVELOPMENT.
The full mapping is in
Lakewatch rule output.
Only batch rules are generated (streaming is future work).
A profile lists the Sigma fields its parser has no data for as unsupported, for example
OriginalFileName. By default, a rule that uses one converts in a narrower form when dropping the
field can't make the rule match more than it was written to (for example one alternative of an
OR), and fails otherwise. This is visible: a LakewatchPrunedWarning, a pruned list in
conversion_report.yaml and a sigma_pruned_fields annotation. Pass -O prune_unsupported=false
to fail instead. See
Pruning unsupported fields.
Supported parsers
Built-in profiles cover these Lakewatch parsers:
- Cloud: AWS CloudTrail, Okta, Azure (audit, sign-in, activity, Identity Protection), Microsoft 365 audit (general, Azure AD, Exchange), GCP Cloud Audit Logs, Google Workspace.
- Web servers and proxies: Cloudflare, GCP HTTP load balancer, Akamai WAF, AWS WAF, Zscaler ZIA, Cisco Umbrella.
- EDR: CrowdStrike FDR, SentinelOne Deep Visibility, Carbon Black Cloud.
- Windows event logs: Sysmon, Security, PowerShell and other channels. Most of these profiles need the custom Windows parsers, which aren't Lakewatch built-ins yet.
See Built-in profiles for the profile ids, the logsources they match, and their limitations. To support another parser, write your own profile (see Writing profiles).
Correlation rules (Lakewatch)
The lakewatch format converts Sigma correlation rules of these types: event_count,
value_count, temporal, temporal_ordered, value_sum, value_avg, value_percentile and
value_median. They work over signals, as Lakewatch correlations do:
-
A base rule (a rule that a correlation references) is a normal Lakewatch rule that writes signals. When the correlation has
generate: false(the Sigma default), the base rule getssuppress_until_time: "9999-12-31T23:59:59Z": it writes signals and opens no alerts. Withgenerate: trueit also alerts. Every referenced base rule getsdeduplication: DEDUPLICATION_ENABLEDand adeduplication_time_windowequal to its run window (scheduleplusextend_lookback), so overlapping runs don't write a signal twice. -
The correlation rule reads
`<catalog>`.`__lakewatch`.`signals`for the rules of its base rules (one per converted profile). It uses a sliding window: for each signal, windowgholds the signals of the same group in thetimespanbefore it (RANGE BETWEEN INTERVAL <seconds> SECONDS PRECEDING AND CURRENT ROW), so a burst is found wherever it starts. The condition (gt,gte,lt,lte,eq,neq) is checked on each window, and the matching windows are reduced to one row per group:window_startis the earliest signal of a matching window andwindow_endthe latest matching signal. When a group matches several times in one run,window_startandwindow_endspan from its first to its last matching signal, which can be longer thantimespan, andevent_countandvalue_countare the largest values among the matching windows. Thetimespancan be given in seconds (30s). -
Each type adds its own output column to the alert context. Every correlation also has its group-by keys,
window_start,window_endandrules.Type Output column event_countevent_countvalue_countevent_count,value_counttemporalevent_count,rule_count(norule_countwith an extended condition)value_sum,value_avg,value_percentile,value_medianevent_countand the column named like the typetemporal_orderednone (no count column) -
The numeric types read the value with
try_cast(<field> AS DOUBLE). A signal with a missing or non-numeric value is dropped.value_medianis rendered aspercentile(<field>, 0.5), as Databricks rejectsmedian()as a window function with a frame. -
A
temporalcorrelation can use an extended condition (rule_a and rule_b,a or (b and c),not): each rule name becomes a test on the rules seen in the window. Other types reject extended conditions. -
A
temporal_orderedcorrelation matches when its rules fire in the order listed, within thetimespan, for the same group. Only the default condition (gte <number of rules>) is supported, and extended conditions are rejected. A step at the same timestamp as the previous one counts as in order, except two consecutive steps of the same rule, which must be strictly ordered. Limit: with a non-consecutive repeat (a, b, a) and all three signals in the same second, oneasignal can fill steps 1 and 3. Cost: one window pass per step after the first. -
A chain is a correlation that references another correlation. When the parent correlation has
generate: false(the default), a referenced child correlation is emitted suppressed, so it writes signals and opens no alerts; withgenerate: trueon the parent it alerts too. The parent'sgroup-bykeys must be output columns of the child, otherwise the parent fails, naming the child and the key. A parent fails when any correlation it references has no converted document, and atemporalortemporal_orderedparent fails when any rule it references has none. A chainedevent_countcounts the child's signals (alerts), not events. Theextend_lookbackis the timespan plus the schedule times the chain depth. Reference cycles fail withcorrelation reference cycle. -
A
value_countcounts the distinct values of itsfield. With a list of fields it counts the distinct combinations (size(collect_set(struct(f1, f2)))), and every field becomes a context key. -
event_count,value_count,temporalandvalue_sumconditions withlt,lte,neqoreq, and extended conditions withnot, convert with aUserWarning(also in the report's resultwarnings; it points at the caller). A window with few signals exists around almost any signal, and the count of a sliding window climbs one signal at a time through a burst, soeq: 5fires for any group with at least 5 signals in the timespan. Such a rule can match much more than intended.value_avg,value_percentileandvalue_mediandon't warn: their values don't climb with the signal count. -
Each
group-byand value field becomes a context key of the base rule, with the characters outside[A-Za-z0-9_]replaced by_(userIdentity.arnbecomesuserIdentity_arn) and a_prefix when it starts with a digit. The key is filled from the select columnsigma_corr_<key>. An alias adds a key from the alias name, built the same way (src-ipbecomessrc_ip), and the correlation groups by it. For a base rule, a key that clashes with a context orselectentry of its own override is an error, and so are two keys that differ only in case (Useranduser). -
The correlation's
extend_lookbackis the timespan plus the schedule (times the chain depth), or-O extend_lookbackwhen that is larger. Its alert summary is<title> by {keys}. Only thedefaultentry of the overrides file for the correlation id and thelakewatch:attribute apply, and they can change the summary and context. Entries scoped to a profile for that id are ignored, with aUserWarningthat names them. Aselectoverride on a correlation is an error (this is separate from the base-rule clash rule above).
Converted from a value_count correlation with -O parsers=aws_cloudtrail (trimmed):
rule_name: access_denied__aws_cloudtrail # base rule
batch:
sql:
query: |-
SELECT *, ..., try_variant_get(userIdentity, '$.arn', 'string') AS `sigma_corr_userIdentity_arn`,
eventName AS `sigma_corr_eventName`
FROM main.sec.aws_cloudtrail
WHERE IN_TIMERANGE(time) AND (lower(errorCode) = 'accessdenied')
deduplication: DEDUPLICATION_ENABLED
deduplication_time_window: 1d
suppress_until_time: '9999-12-31T23:59:59Z'
output:
context:
userIdentity_arn: '{sigma_corr_userIdentity_arn}'
eventName: '{sigma_corr_eventName}'
---
rule_name: access_denied_sweep # correlation rule
timerange:
extend_lookback: 1450m
batch:
sql:
query: |-
WITH sig AS (
SELECT DISTINCT event_time, regexp_extract(rule_name, '([^.]+)$', 1) AS rule, CASE rule_name WHEN 'main.sec.access_denied__aws_cloudtrail' THEN 'base' END AS sigma_rule, get_json_object(context, '$.userIdentity_arn') AS `userIdentity_arn`, get_json_object(context, '$.eventName') AS `eventName`
FROM `main`.`__lakewatch`.`signals`
WHERE IN_TIMERANGE(event_time) AND rule_name IN ('main.sec.access_denied__aws_cloudtrail')
),
w AS (
SELECT *, count(*) OVER g AS event_count, size(collect_set(`eventName`) OVER g) AS value_count, min(event_time) OVER g AS window_start, collect_set(sigma_rule) OVER g AS window_rules
FROM sig
WHERE `userIdentity_arn` IS NOT NULL AND `eventName` IS NOT NULL
WINDOW g AS (PARTITION BY `userIdentity_arn` ORDER BY event_time RANGE BETWEEN INTERVAL 600 SECONDS PRECEDING AND CURRENT ROW)
)
SELECT max(event_time) AS time, min(window_start) AS window_start, max(event_time) AS window_end, `userIdentity_arn`, max(event_count) AS event_count, max(value_count) AS value_count, array_join(array_sort(array_distinct(flatten(collect_list(window_rules)))), ', ') AS rules
FROM w
WHERE value_count >= 15
GROUP BY `userIdentity_arn`
HAVING count(*) > 0
deduplication: DEDUPLICATION_ENABLED
deduplication_time_window: 2890m
output:
summary: Access Denied Sweep by {userIdentity_arn}
default_context: false
event_time_column: time
Limits:
- Only
target=workspacein parsed mode (-O parsers=...).content_packand OCSF mode reject correlations. temporal_orderedsupports onlygte <number of rules>, and no extended condition.- A suppressed signal-only rule (a base rule or child correlation) whose correlations all failed is
not emitted; the report lists it as skipped with
its correlation rules failed. - A
group-byor value key can't be named like a column the correlation SQL adds (rule,sigma_rule,event_time,time,window_start,window_end,event_count,value_count,rule_count,value_sum,value_avg,value_percentile,value_median,rules,window_rules,window,g,start,prev_start,is_new; in any case): the correlation fails withgroup-by key <key> clashes with a column of the correlation SQL. - So a parent can't use a child's output column such as
event_countdirectly as itsfieldorgroup-by. Give it an alias (aliases: {n: {<child name>: event_count}}) and usefield: n; the error message suggests this. - A value key that is also a
group-bykey is read as a number (try_cast(... AS DOUBLE)), so its values render like5.0and groups with a non-numeric value are dropped. - A correlation fails with
no converted base ruleswhen none of its base rules converted. When a base rule converted for only some profiles, the correlation uses those, and its report result has anotenaming the missing ones (a base rule with no matching profile is listed too). - In
content_packand OCSF mode, a base rule withgenerate: falseis skipped, with the reasonreferenced by a correlation rule. - Known gap: the
azure_monitor_activityprofile has nocallerfield, so a group-by oncallerfails.
See Conversion report for how base rules and correlations show up in the report.
Deploying rules
To deploy the converted workspace rules, use one of the options below. Content-pack output isn't deployed this way; install the pack instead.
UI. Open Detection rules, pick the rule, then Edit rule, Edit as YAML, and Save changes. See
Edit a rule as YAML.
catalog_name, schema_name and rule_name can't be changed after the rule is created.
One rule with the Databricks CLI (Beta, CLI v1.27 or later). The CLI takes JSON, so convert the YAML file first:
python -c 'import json,sys,yaml; json.dump(yaml.safe_load(open(sys.argv[1])), sys.stdout)' rule.yaml > rule.json
databricks lakewatch create-rule --json @rule.json --profile <profile>
Many rules with lakewatch-rule-deploy. The command creates or updates the workspace rules
written by sigma convert -t databricks -f lakewatch. It deploys detection rules only, not parsers,
data sources or content packs. Install it with the deploy extra:
pip install "pySigma-backend-databricks[deploy]"
sigma convert -s -t databricks -f lakewatch -O parsers=aws_cloudtrail \
-O table_name=main.sec.aws_cloudtrail -O catalog_name=main -O schema_name=sec \
-O warehouse_id=1234567890abcdef -O output_dir=detections rules/
lakewatch-rule-deploy --profile <profile> --dry-run detections/
lakewatch-rule-deploy --profile <profile> detections/
Common flags:
| Flag | Meaning |
|---|---|
--profile PROFILE |
Databricks CLI profile. Default: the SDK's standard auth chain. |
--dry-run |
Validate and print the planned changes; write nothing. |
--validate-only |
Validate the rules that would be written; write nothing. |
--warehouse-id ID |
Deploy with another SQL warehouse than the one in the files; also used for the validation dry run. |
--catalog C, --schema S |
Deploy into another catalog or schema than the one in the files. |
--force |
Overwrite rules that were not made from this Sigma rule. |
--json |
Print the result as JSON. |
Redeploying is safe: a rule is updated only if it was made from the same Sigma rule, unchanged
rules are left alone, schedule.enabled is kept, and nothing is ever deleted. Creating or updating
a rule starts a one-time run of it on the server. See
Deploying rules
for all flags, the output format and the exit codes.
Plain SQL output
The default, dbsql and detection_yaml formats produce Spark SQL WHERE conditions, with no
parser profile:
sigma convert -t databricks rules/windows/process_creation/proc_creation_win_whoami_execution.yml
sigma convert -t databricks -f dbsql -p snake_case rules/windows/
Equality lists on one field render as a single IN (...), and |cidr lists as one
exists(array(...), ...), so a long list repeats the field expression once:
lower(Image) IN ('a.exe', 'b.exe')
CIDR Matching
The |cidr modifier is converted using the built-in Databricks IP functions
ip_cidr_contains
and try_ip_as_binary (Databricks Runtime 18.2+, IPv4 and IPv6). Field values that aren't valid
IP addresses evaluate to NULL instead of failing the query. Note that, following SQL NULL
semantics, such rows don't match the negated condition either (e.g. condition: not sel), so they
are excluded from both sel and not sel results:
detection:
sel:
src_ip|cidr: 192.168.0.0/16
condition: sel
Generates: ip_cidr_contains('192.168.0.0/16', try_ip_as_binary(src_ip))
For other Spark SQL engines (e.g. open source Apache Spark), override the expression with the
cidr_expression option. It's a format string with the placeholders {field}, {value}
(whole CIDR), {network}, {prefixlen} and {netmask}:
sigma convert -t databricks -O "cidr_expression=cidrmatch({field}, '{value}')" rule.yml
backend = DatabricksBackend(cidr_expression="cidrmatch({field}, '{value}')")
You need to register the corresponding function (here cidrmatch) as a UDF yourself.
Unbound Keyword Search
Sigma rules with unbound keywords (values without field names) search the raw log line. By
default, the backend looks for keywords in a field named raw (raw_data when the target is
OCSF). Set another field with -O raw_log_field=message, or
DatabricksBackend(raw_log_field="message"). With -f lakewatch, each profile defines its own raw
event (see
Keyword search and routing).
detection:
selection:
EventID: 4688
keywords:
- 'mimikatz'
- '|re': '.*evil(cmd|powershell).*'
condition: selection and keywords
Generates: EventID = 4688 AND (contains(lower(raw), 'mimikatz') OR raw rlike '.*evil(cmd|powershell).*')
Keywords in a list are ORed, and '|all' ANDs them. Wildcards turn into contains()
(*malware*), startswith() (cmd.exe*) or endswith() (*.dll).
Maintainer
This backend is currently maintained by:
Metadata
Release files for pySigma-backend-databricks 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pysigma_backend_databricks-0.2.1.tar.gz | 306.4 kB | With provenance | Details for pysigma_backend_databricks-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pysigma_backend_databricks-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for pysigma_backend_databricks-0.2.1-py3-none-any.whl |
Total release size: 542.6 kB
Release files / pysigma_backend_databricks-0.2.1.tar.gz
| Download URL | pysigma_backend_databricks-0.2.1.tar.gz |
|---|---|
| Size | 306.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4c0dc2c15a02870d3fba4635d88546eb94d7a7beb3eab5e2c027b2b2f6b8dd0
|
|
BLAKE2b-256 checksum How to use checksums |
2e6010041daf56be9c8ca5b2c3470fb302e986fa9f83eb5639b37ae66d055345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logRelease files / pysigma_backend_databricks-0.2.1-py3-none-any.whl
| Download URL | pysigma_backend_databricks-0.2.1-py3-none-any.whl |
|---|---|
| Size | 236.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ddda19a947a5c0aabfb800b344f06a1f18bd593e5fc2a26b22b5f7e3e04addf
|
|
BLAKE2b-256 checksum How to use checksums |
cff39d73307b79bfc83f0c84c1d235a787ee15422cf504aaa150bf7a40ea451b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logSecurity for pySigma-backend-databricks 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pysigma_backend_databricks-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.