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

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, temporal_ordered) are unsupported — LogsQL has no native multi-event window join.
  • -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.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-victorialogs 0.2.0
File Size Uploaded
pysigma_backend_victorialogs-0.2.0.tar.gz 21.1 kB Details

Built distribution (wheel)

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

Total release size: 43.4 kB

Release files / pysigma_backend_victorialogs-0.2.0.tar.gz

Download URL pysigma_backend_victorialogs-0.2.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8a2af96a3ec733adc9423963cdcefa84bf0a33ac54c5508fefa21c9731b94556
BLAKE2b-256 checksum
How to use checksums
4b0fe94e48cbe0b471b2aa0d07ae16cf4af4deec34f85657117597700f1aae4c
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 9, 2026.

Transparency log

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

Download URL pysigma_backend_victorialogs-0.2.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a0c4ada292a394c0c76f9ae86f455cb2aa936f58e86834a65302cd5871c3575
BLAKE2b-256 checksum
How to use checksums
8883e9fb1a4c180f23ded4f5f2d632c41874c1f531ddcda30474ec709b167caa
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 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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