Skip to main content

SIEMs

urlquery's webhooks tell you when one of your YARA rules matches a new report, a watchlist sees one of its indicators, or a page monitor sees a change. urlquery_siem_relay.py receives them, checks their signature, and forwards each one to Splunk's HTTP Event Collector, Elasticsearch, or Microsoft Sentinel, where you can search them beside your proxy, DNS and mail logs. It needs only Python's standard library.

Run it​

export URLQUERY_WEBHOOK_SECRET='whsec_…' # the webhook channel's signing secret

# Splunk: an HTTP Event Collector token
export SPLUNK_HEC_URL='https://splunk.example.org:8088' SPLUNK_HEC_TOKEN='<HEC token>'
# or Elasticsearch: an API key that can write to the index
export ELASTIC_URL='https://elastic.example.org:9200' ELASTIC_API_KEY='<API key>'
# or Microsoft Sentinel: see "Microsoft Sentinel" below
export SENTINEL_ENDPOINT='https://<logs ingestion endpoint>' SENTINEL_DCR_ID='dcr-<immutable id>'
export AZURE_TENANT_ID='<tenant ID>' AZURE_CLIENT_ID='<application ID>' AZURE_CLIENT_SECRET='<client secret>'

python urlquery_siem_relay.py --port 8080
  1. Put the relay behind your HTTPS reverse proxy; it listens on 127.0.0.1 unless you pass --host.
  2. On urlquery.net, under Settings → Notifications, add a Webhook channel with the proxy's URL. Choose yara.match, monitor.indicator_seen and monitor.page_changed, or the kinds you want.
  3. Copy the channel's signing secret into URLQUERY_WEBHOOK_SECRET, and send a Test notification.
SettingDefaultMeaning
SPLUNK_INDEXthe token's defaultSplunk index for the events. Their sourcetype is urlquery:notification.
ELASTIC_INDEXurlquery-notificationsElasticsearch index for the documents.
SENTINEL_STREAMCustom-UrlqueryNotifications_CLThe data collection rule's input stream.

What it guarantees. The relay forwards each message before it answers. When the SIEM is down or refuses the event, it answers 502, and urlquery retries the message twice. A request without a valid, recent signature gets 401 and is never forwarded. In Elasticsearch, each message is stored under its id, so a repeated message is stored once; in Splunk, drop repeats in searches with dedup id, and in Sentinel by NotificationId.

Microsoft Sentinel​

The relay sends to the Log Analytics workspace behind Sentinel through Azure Monitor's Logs Ingestion API. Set up three things in Azure first, as in Microsoft's tutorial:

  1. An app registration in Microsoft Entra ID, with a client secret. The relay signs in as it.

  2. A custom table and its data collection rule. In the workspace, under Tables, select Create and New custom log (DCR based). Name the table UrlqueryNotifications, which becomes UrlqueryNotifications_CL, upload this sample, and keep the transformation as source:

    [{"TimeGenerated": "2026-11-29T10:00:00Z", "NotificationId": "alert.created:r-1:rule-1", "Kind": "yara.match",
    "Heading": "YARA rule match", "ReportUrl": "https://urlquery.net/report/r-1",
    "Fields": [{"label": "URL", "value": "login.example.com/verify"}],
    "Data": {"report_id": "r-1", "url": "login.example.com/verify", "matches": []}}]
  3. Access: on the data collection rule, under Access control (IAM), give the app the Monitoring Metrics Publisher role.

Then set SENTINEL_DCR_ID to the rule's immutable ID (dcr-…), and SENTINEL_ENDPOINT to its logs ingestion endpoint, both in the rule's JSON view, or to the data collection endpoint you chose for it.

Each notification becomes one row: TimeGenerated (when it happened), NotificationId (the message's id), Kind, Heading (its title), ReportUrl, and Fields and Data as dynamic columns. Title and id are reserved column names in custom tables, hence Heading and NotificationId.

Search the notifications​

Each event is the webhook's JSON as it arrived; see the body and kinds. Read values from data.

Splunk

sourcetype="urlquery:notification" kind="yara.match"
| dedup id
| spath path=data.matches{}.alert output=alert
| spath path=data.matches{}.severity output=severity
| table _time data.report_id data.url data.ip alert severity url

Hosts a watchlist matched, and who in your network visited them, assuming a proxy index with a dest_host field:

index=proxy
[ search sourcetype="urlquery:notification" kind="monitor.indicator_seen" earliest=-7d
| spath path=data.matches{}.value output=dest_host
| mvexpand dest_host
| dedup dest_host
| fields dest_host ]
| stats count earliest(_time) AS first latest(_time) AS last BY src_user dest_host

Microsoft Sentinel

UrlqueryNotifications_CL
| where Kind == "yara.match"
| summarize arg_max(TimeGenerated, *) by NotificationId
| mv-expand Match = Data.matches
| project TimeGenerated, ReportUrl, Url = tostring(Data.url), Alert = tostring(Match.alert), Severity = tostring(Match.severity)

Hosts a watchlist matched, and who visited them, from a firewall or proxy that writes to CommonSecurityLog:

let Seen = UrlqueryNotifications_CL
| where TimeGenerated > ago(7d) and Kind == "monitor.indicator_seen"
| mv-expand Match = Data.matches
| where tostring(Match.kind) == "fqdn"
| distinct Host = tolower(tostring(Match.value));
CommonSecurityLog
| where TimeGenerated > ago(7d)
| where tolower(DestinationHostName) in (Seen)
| summarize Requests = count(), First = min(TimeGenerated), Last = max(TimeGenerated) by SourceUserName, DestinationHostName

A watchlist's domain indicators also match subdomains; compare those with endswith instead of in. To raise incidents, turn either query into a scheduled analytics rule.

Elasticsearch and Kibana

kind : "yara.match" and data.matches.severity : ("high" or "critical")
FROM urlquery-notifications
| WHERE kind == "monitor.indicator_seen"
| KEEP @timestamp, data.name, data.url, data.report_id
| SORT @timestamp DESC

Values in the notifications come from analyzed pages, which are often malicious. Show them as text; don't make the SIEM fetch or link them.

Enrich your own alerts​

The relay brings urlquery's findings in. To go the other way, and ask urlquery about a URL from one of your SIEM's alerts, hand the alert to a playbook: the SOAR action turns a URL into a block, review or no_evidence decision with the evidence, and the same calls fit a SIEM's own script or alert actions.

Watch your quota when you do. An alert that fires for every proxy request would analyze every URL; reuse recent reports, as the action does, and send only alerts worth a look.