Skip to main content

Tests ![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/alexott/GitHub Gist identifier containing coverage badge JSON expected by shields.io./raw/alexott-databricks-sigma-backend.json) Status

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

  1. 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.

  2. Convert the rules for the selected parsers. -s skips 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 a conversion_report.yaml that lists what converted, what failed and why (see Conversion report). Don't use the --output-dir/-od option of sigma-cli: it writes only the bare SQL condition of each rule, not the rule documents.

  3. 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.

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).

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).

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.

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySigma-backend-databricks 0.2.0
File Size Uploaded Provenance Actions
pysigma_backend_databricks-0.2.0.tar.gz 259.7 kB With provenance Details for pysigma_backend_databricks-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pySigma-backend-databricks 0.2.0
File Interpreter ABI Platform Actions
pysigma_backend_databricks-0.2.0-py3-none-any.whl Python 3 none any Details for pysigma_backend_databricks-0.2.0-py3-none-any.whl

Total release size: 468.2 kB

Release files / pysigma_backend_databricks-0.2.0.tar.gz

Download URL pysigma_backend_databricks-0.2.0.tar.gz
Size 259.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d86e2ae61d53b9ac0aa6f80a5f277e9528f42f7006967b8e48007b76c8b67222
BLAKE2b-256 checksum
How to use checksums
574d1ee9fb4c964debc0f7e8409b72ad01519a222e038c1040d789d042207b90
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 Nov 27, 2026.

Transparency log

Release files / pysigma_backend_databricks-0.2.0-py3-none-any.whl

Download URL pysigma_backend_databricks-0.2.0-py3-none-any.whl
Size 208.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f6e60bcf84793e2910cdefebe812d81f919d1d5bc419c7d510ec73d007beea5
BLAKE2b-256 checksum
How to use checksums
170b023ca28a7be41510348896d2314d205aa877d53649874851f6d8fd2476e9
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 Nov 27, 2026.

Transparency log

Security for pySigma-backend-databricks 0.2.0

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.

Select from 2 files

Attestation for pysigma_backend_databricks-0.2.0.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 Nov 27, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page