{% extends "base.html" %} {% block title %}Matching rules — BackupWatch{% endblock %} {% block main_class %}rules2{% endblock %} {% block content %} {% set vendor_pill = {'veeam':'manual','dropsuite':'dropsuite','synology':'learned','other':'other'} %} {% set status_dot = {'success':'#12a150','warning':'#e5a000','failure':'#e5484d'} %} {% set status_text = {'success':'#0d7a3d','warning':'#9a6f00','failure':'#c3282d'} %}
EMAIL → JOB MATCHING

Matching rules

{% set ns = namespace(total=0, manual=0, learned=0) %} {% for c in clients %}{% for j in c.jobs %}{% for r in j.rules %} {% set ns.total = ns.total + 1 %} {% if r.learned %}{% set ns.learned = ns.learned + 1 %}{% else %}{% set ns.manual = ns.manual + 1 %}{% endif %} {% endfor %}{% endfor %}{% endfor %}
{{ ns.total }} rule{{ '' if ns.total == 1 else 's' }} across {{ clients|length }} client{{ '' if clients|length == 1 else 's' }} · {{ ns.manual }} AND · {{ ns.learned }} OR AND all must match OR any one matches
{% for c in clients %}
{{ c.display_name }} {{ c.jobs|map(attribute='rules')|map('length')|sum }} {% if c.identifiers() %} IDENTIFIED BY {% for ident in c.identifiers() %}{{ ident }}{% endfor %} {% endif %} {% if c.jobs %} {% endif %}
{% for j in c.jobs %}
{{ j.name }} {{ j.vendor }} {{ j.rules|length }} rule{{ '' if j.rules|length == 1 else 's' }}
{% for r in j.rules %}
{{ r.field }} {{ r.operator }} {{ r.value }} {{ 'Case-sensitive' if r.case_sensitive else 'Any case' }} {% if r.learned %}OR · ANY{% if r.machine_learned() %} learned{% endif %}{% else %}AND · ALL{% endif %}
{% endfor %} {% if not j.rules %}
No rules — this job never auto-matches.
{% endif %}
{% endfor %}
No rule matches that filter for this client.
{% else %}
No clients yet — add one to start defining matching rules. Go to Clients →
{% endfor %} {# ---- custom vendor rules ---- #}

Your vendor rules

Teach BackupWatch a product it doesn't know natively
{% for v in vendor_defs %}
{{ v.name }} {{ {'from':'sender','subject':'subject','body':'body','subject_body':'subject/body'}.get(v.match_in, v.match_in) }} · {{ v.identifiers.replace('\r','').replace('\n', ', ') }} else {{ v.default_status }} {% if not v.active %}DISABLED{% endif %}
{% else %}
No custom vendor rules yet. Built-in detection covers Veeam, DropSuite and Synology — add a rule here for anything else, like Acronis or Datto.
{% endfor %}
{# ---- built-in detection reference (collapsed) ---- #}

Built-in detection

How each vendor and its status are recognised — first match wins
{# ---- sidebar ---- #}

Test matching

Paste an email to see which job it would hit.
{% if test is defined and test %}
{{ 'MATCHED' if test.job else 'NO JOB MATCH' }}
CLIENT {% if test.client %}{{ test.client }}{% else %}Not identified{% endif %}
JOB {% if test.job %}{{ test.job_name }}{% else %}Review queue{% endif %}
VENDOR {{ test.vendor|upper }} {{ test.status|upper }}
{% if test.via %}
VIA{{ test.via }}
{% endif %} {% if test.ambiguous %}
More than one job matched with equal specificity — in the live pipeline this email would go to Review, not be guessed.
{% endif %} {% if not test.job %}
This email would land in the Review queue. Assigning it there writes a learned rule automatically.
{% endif %}
{% endif %}
MATCHING PIPELINE
1Sender or domain identifies the client
2Rules below pick the job — first match wins
3Vendor detection reads the status
4No job match → Review queue
A rule is field · operator · value — from, subject or body; contains, equals or regex.
{# ---- add rule drawer ---- #}
Add a rule
Job Field
Operator
Matches when the value appears anywhere in the field — the usual choice.
Value to match
Rules added here are manual, so every manual rule on the job must match. For an email you weren't expecting, it's usually quicker to assign it in the Review queue — that writes a learned rule for you.
{# ---- add vendor rule drawer ---- #}
Add a vendor rule
Product name Identify it by Identifiers one per line
STATUS KEYWORDS
Failure
Warning
Success
If nothing matches, record it as
Precedence: failure keywords win, then warning, then success, otherwise the default. Custom rules are checked after the built-in Veeam, DropSuite and Synology detectors.
{% endblock %}