Skip to main content

pySigma backend for VictoriaLogs (LogsQL)

CI PyPI Python License: MIT

Convert Sigma detection rules to LogsQL queries that run against VictoriaLogs.

Sigma rule (YAML)
        │
        ▼
   pySigma core
        │
        ▼
 VictoriaLogsBackend  ──►  field:="value" AND other:~"regex"

Install

The recommended way is via sigma-cli's plugin system:

pip install sigma-cli
sigma plugin install victorialogs

Or directly as a library:

pip install pysigma-backend-victorialogs

First query

sigma convert -t victorialogs path/to/rule.yml

Programmatic use:

from sigma.collection import SigmaCollection
from sigma.backends.victorialogs import VictoriaLogsBackend

rule = SigmaCollection.from_yaml("""
title: SSH login failure
logsource:
    product: linux
    service: auth
detection:
    sel:
        program: sshd
        message|contains: "Failed password"
    condition: sel
""")

print(VictoriaLogsBackend().convert(rule)[0])
# program:="sshd" AND message:~"Failed password"

See docs/getting_started.md for the full walkthrough including a local VictoriaLogs container.


Compatibility

Component Supported versions
Python 3.10, 3.11, 3.12, 3.13, 3.14
pySigma ^1.1.0
VictoriaLogs v1.53.0 (pinned by digest in CI)

CI pins victoriametrics/victoria-logs:v1.53.0 by sha256 digest for reproducibility; bumps follow the procedure in CONTRIBUTING.md. Older or newer VL versions are not actively tested but should work as long as they parse the LogsQL constructs listed in docs/mapping.md.

Mapping summary

Sigma feature LogsQL output
field: value field:="value"
field|contains: x field:~"x" (regex)
field|startswith: x field:="x"* (native prefix)
field|endswith: x field:~"x$" (regex anchor)
field|re: pattern field:~"pattern"
field|cidr: 10.0.0.0/8 field:ipv4_range("10.0.0.0/8")
field|cidr: ::1/128 field:ipv6_range("::1/128")
field|gte: 1024 field:>=1024
field|fieldref: other field:eq_field(other)
field|exists: true field:*
field: null field:""
field IN [a, b] field:in("a", "b")
event_count correlation _time:Xm (<search>) | stats by (g) count() as event_count | filter event_count:>=N
temporal correlation _time:Xm ((A) OR (B)) | stats by (g) count() if ((A)) as r0, count() if ((B)) as r1 | filter r0:>0 r1:>0

Full reference: docs/mapping.md.

Pipelines

Sigma rules use a neutral field taxonomy (Image, CommandLine, EventID, …) that does not match how any specific log shipper writes records. Pick a pipeline that matches your ingestion path:

Pipeline Targets Renames
victorialogs (no-op placeholder) none
victorialogs_windows_eventlog Winlogbeat / Vector ECS Windows ingest EventID→winlog.event_id, EventData→winlog.event_data.*, channel selectors
victorialogs_journald systemd-journal native fields Image→_EXE, CommandLine→_CMDLINE, Message→MESSAGE, …
victorialogs_caddy Caddy v2 JSON access logs cs-method→request.method, cs-uri-*→request.uri, sc-status→status, …
victorialogs_suricata Suricata EVE JSON dst_ip→dest_ip, QueryName→dns.rrname, TlsServerName→tls.sni, …
victorialogs_podman podman/docker journald CONTAINER_* ContainerName→CONTAINER_NAME, ImageName→IMAGE_NAME, …
sigma convert -t victorialogs -p victorialogs_journald rule.yml
sigma convert -t victorialogs -p victorialogs_windows_eventlog rule.yml
sigma convert -t victorialogs -p victorialogs_caddy rule.yml

Each pipeline applies only to rules whose logsource matches its target (e.g. product: linux for journald, category: webserver for Caddy, category: network or product: zeek|suricata for the EVE pipeline); other rules pass through untouched. Stack pipelines with multiple -p flags when, for example, podman containers ship through journald.

Output formats

Format Output
default Plain LogsQL query strings (one per rule)
vmalert vmalert rule group YAML (type: vlogs) for VictoriaLogs
grafana_alerting Grafana Alerting provisioning YAML (apiVersion: 1) for the victoriametrics-logs-datasource plugin

vmalert (deploy as alerting rules)

sigma convert -t victorialogs -f vmalert -p victorialogs_journald \
    rules/*.yml > sigma-rules.yaml

The output is a single rule group ready to feed to vmalert pointed at a VictoriaLogs datasource:

vmalert \
    -datasource.url=http://victorialogs:9428 \
    -rule.defaultRuleType=vlogs \
    -rule=sigma-rules.yaml \
    -notifier.url=http://alertmanager:9093

Each Sigma rule becomes one alert with expr wrapped as <query> | stats count() as matches | filter matches:>0 (correlation rules already aggregate and pass through unwrapped). vmalert auto-prepends _time:<group_interval>, so the emitted expressions are time-agnostic by design — change the evaluation window via the group interval (default 5m) rather than editing every query. Sigma level maps to labels.severity and id to labels.sigma_id. Requires vmalert ≥ v1.93 (when type: vlogs was added). See docs/mapping.md §14 for the full mapping.

grafana_alerting (deploy as Grafana provisioned alert rules)

sigma convert -t victorialogs -f grafana_alerting \
    -O grafana_datasource_uid=<your-vl-uid> \
    rules/*.yml > /etc/grafana/provisioning/alerting/sigma.yaml

The output is an apiVersion: 1 provisioning document that Grafana loads on boot. Pass the UID of the VictoriaLogs datasource as configured in your Grafana install — the placeholder default (victorialogs) keeps the emitted YAML valid but will not load until substituted.

Each Sigma rule becomes one alert rule with a two-node data array:

  • refId A runs the LogsQL stats query against the victoriametrics-logs-datasource plugin's /select/logsql/stats_query endpoint (Grafana ≥ 10.4 required).
  • refId B is a server-side threshold expression that fires when A returns a non-zero count. condition: B is the rule's firing condition.

The Sigma → Grafana severity bucket is:

Sigma level labels.severity
critical critical
high warning
medium info
low info
informational info

Backend options (-O <name>=<value>):

Option Default Meaning
grafana_datasource_uid victorialogs UID of the VictoriaLogs datasource in your Grafana.
grafana_folder sigma Folder the alert-rule group is stored in.
grafana_org_id 1 Grafana org ID.
grafana_interval 1m Group evaluation interval.
grafana_relative_time_from 600 Lookback in seconds for the query (to is always 0).

Deploying the rule provisioning file does not create the VictoriaLogs datasource itself — provision the datasource separately, then point the generated rules at it via grafana_datasource_uid. A complete deployment walkthrough (datasource provisioning + alert provisioning + alert-firing sanity check) lives at tests/e2e/grafana_alerting/README.md.

Limitations

  • Temporal correlations (temporal, and temporal_ordered for two rules) are supported via conditional stats. Three-rule ordering and "at least N of M rules" conditions are not expressible — see limitations.
  • -search.maxQueryLen defaults to 16 KiB; seven SigmaHQ rules emit queries above this. Raise the flag at VL startup if you need them: victoria-logs -search.maxQueryLen=524288 ...
  • No native single-character wildcard — Sigma ? routes to regex.
  • Case-sensitivity is the default (LogsQL :=).

Full details and workarounds: docs/limitations.md.

Verifying releases

From v0.2.0 onward, every tagged release is signed with Sigstore via GitHub Actions OIDC. The signature bundles (*.sigstore.json) are attached to the corresponding GitHub release; the wheel and sdist on PyPI also carry a PEP 740 attestation (shown as a "Verified" badge on pypi.org).

Verify a downloaded artefact with sigstore-python:

gh release download v0.2.0 \
  --repo aris1009/pySigma-backend-victorialogs \
  --pattern '*.whl' --pattern '*.whl.sigstore.json'

pip install sigstore
sigstore verify github \
  --cert-identity "https://github.com/aris1009/pySigma-backend-victorialogs/.github/workflows/release-please.yml@refs/heads/main" \
  pysigma_backend_victorialogs-0.2.0-py3-none-any.whl

The cert-identity is the path of the workflow that produced the signature; because release-please publishes on push-to-main, the ref is refs/heads/main rather than the release tag.

Documentation

License

MIT © aris1009

Metadata

Release files for pySigma-backend-victorialogs 0.4.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-victorialogs 0.4.0
File Size Uploaded Provenance Actions
pysigma_backend_victorialogs-0.4.0.tar.gz 22.6 kB With provenance Details for pysigma_backend_victorialogs-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 46.0 kB

Release files / pysigma_backend_victorialogs-0.4.0.tar.gz

Download URL pysigma_backend_victorialogs-0.4.0.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cc0ba7498966c52b587112b71d889f1edf4215deb4f4e71a3ee559ab226c5369
BLAKE2b-256 checksum
How to use checksums
f2f416e84a0d9242a415ff9af6e2d5041d25dd716ed4f486699303153ce39732
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 14, 2026.

Transparency log

Release files / pysigma_backend_victorialogs-0.4.0-py3-none-any.whl

Download URL pysigma_backend_victorialogs-0.4.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecdda8baf764985c67eaaaabe9668a7f55d4d0614d776dd9e05732e29542af12
BLAKE2b-256 checksum
How to use checksums
ddb9b46c0be2b00b3138050b728051c05ce80c64409ba527036c1dc7c788c221
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 14, 2026.

Transparency log

Security for pySigma-backend-victorialogs 0.4.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_victorialogs-0.4.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 14, 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