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

It supports the following output formats:

  • 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
  • lakewatch: Lakewatch detection rules (kind: Rule YAML), batch by default

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.

The backend supports Sigma rules with unbound keywords (values without field names). These keywords search the raw log line.

Configuration

By default, the backend looks for keywords in a field named raw. You can customize this:

Command Line:

sigma convert -t databricks -O raw_log_field=message rule.yml

Programmatic:

from sigma.backends.databricks import DatabricksBackend

backend = DatabricksBackend(raw_log_field="event_data")

Examples

Simple Keywords (OR logic):

detection:
    keywords:
        - 'EVILSERVICE'
        - 'svchost.exe -n evil'
    condition: keywords

Generates: contains(lower(raw), lower('EVILSERVICE')) OR contains(lower(raw), lower('svchost.exe -n evil'))

Keywords with |all (AND logic):

detection:
    keywords:
        '|all':
            - 'Remove-MailboxExportRequest'
            - ' -Identity '
    condition: keywords

Generates: contains(lower(raw), lower('Remove-MailboxExportRequest')) AND contains(lower(raw), lower(' -Identity '))

Mixed with Field Conditions:

detection:
    selection:
        EventID: 4688
    keywords:
        - 'mimikatz'
    condition: selection and keywords

Generates: EventID = 4688 AND contains(lower(raw), lower('mimikatz'))

Wildcards in Keywords:

detection:
    keywords:
        - '*malware*'      # uses contains()
        - 'cmd.exe*'       # uses startswith()
        - '*.dll'          # uses endswith()
    condition: keywords

Regex Patterns:

detection:
    keywords:
        - '|re': '.*evil(cmd|powershell).*'
    condition: keywords

Generates: raw rlike '.*evil(cmd|powershell).*'

Lakewatch Output

Generate Lakewatch detection rules (kind: Rule YAML) from Sigma rules. Intended to run after the OCSF pipeline, which normalizes fields and injects the OCSF class, so the backend can pick the gold table.

sigma convert -t databricks -f lakewatch -p ocsf rules/ -o detections.yaml

Multiple rules are emitted as separate --- documents in one file.

Options (-O key=value)

Option Default Meaning
table_name (derived) FROM table. If unset, derived from the OCSF class the pipeline injected; error if neither is available.
lookback 25 HOUR Batch window (Spark interval syntax) in the time >= now - INTERVAL <lookback> predicate.
schedule 24h spec.schedule.atLeastEvery (Lakewatch duration).
compute_group automatic spec.schedule.computeGroup.
default_fidelity (from status) Override spec.metadata.fidelity.
default_category Static Signature spec.metadata.category.
sigma convert -t databricks -f lakewatch -p ocsf \
  -O table_name=main.security.authentication -O lookback="1 DAY" -O schedule=12h rule.yml

Sigma metadata maps to Lakewatch as: title→displayName, description→comment/objective, level→severity, status→fidelity, and attack.* tags→mitre. Only batch rules are generated (streaming is future work).

Maintainer

This backend is currently maintained by:

Metadata

Release files for pySigma-backend-databricks 0.1.7

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.1.7
File Size Uploaded Provenance Actions
pysigma_backend_databricks-0.1.7.tar.gz 31.7 kB With provenance Details for pysigma_backend_databricks-0.1.7.tar.gz

Built distribution (wheel)

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

Total release size: 55.7 kB

Release files / pysigma_backend_databricks-0.1.7.tar.gz

Download URL pysigma_backend_databricks-0.1.7.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f5d062c69f7a7e3861e518ff53f5e1bea6a8e5b5912863a010c4e64c5271ea00
BLAKE2b-256 checksum
How to use checksums
25e3804e0351240344c99a07f7c6fcd22f47858d18a2092af9b90623763a15a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

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

Download URL pysigma_backend_databricks-0.1.7-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01760b51574234a4f7c0837dae033c492fbcee0296522bdfaeabcd4547344432
BLAKE2b-256 checksum
How to use checksums
c635863fd818accd9ae80a7e1753c95a69f2c27fbdcfa808c17e93aea404088b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for pySigma-backend-databricks 0.1.7

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.1.7.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 Oct 19, 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