Skip to content

Analytics, saved filters and dashboards ​

These commands query the analytics of the running node, and manage the saved filters and dashboards that present them. They are described in admin guide section 33.

They talk to the running node's management API, so they need a signed-in or local admin-socket session like the other commands. They answer for this node's traffic records and the cluster's events.

Common flags: -runtime-dir DIR (the running Spalto's runtime directory) and -json.

waap analytics ​

Answers questions about the traffic records and events.

sh
waap analytics top|series|histogram|count|query|fields|validate|to-rule
SubcommandWhat it does
top -by FIELD [-n N]The most common values of a field and how many were blocked. Default 10, at most analytics.max_top_n (default 100).
series [-by FIELD] [-bucket 1m|5m|15m|1h|6h|1d]Requests per time bucket, optionally one line per value of FIELD (ten values and "other"). The default bucket gives at most analytics.max_buckets (360) buckets.
histogram -by FIELDDistribution of a score field (attack.score, automation.score).
count [-agg unique|sum -by FIELD]One number: matching records, distinct values of FIELD, or the sum of FIELD.
query -kind top|series|histogram|count [-field F] ...The same questions, with the kind as a flag.
fields [list]The field catalogue for -source (name, type, group, help, whether it can be grouped). Use these names in -q and -by.
validate -q FILTERParses and checks a filter without reading data. Prints the canonical text, or the error with its byte position. Exit code 1 when invalid.
to-rule -q FILTER [-name N]Drafts an access rule (condition and action log) from a filter, and lists fields that cannot be used in a rule. Nothing is applied. Operator role.

Flags:

FlagWhat it doesDefault
-source traffic|eventsData source.traffic
-q FILTERFilter in the explorer's language.
-since 24h|RFC3339Start of the window.24h
-until TIMEEnd of the window.now
-app NAMEApplication.
-node NAMEOnly this node answers. Another node's name is refused.
-n NNumber of results.
-bucketTime bucket for series.
-aggAggregation for count: unique or sum.
-byField to group by.
-fieldSame as -by, for query.
-kindQuery kind for query.
-jsonJSON output.

A sampled or approximate answer says so.

Exit codes: 0 for success, 1 for refused or failed, 2 for bad usage.

Network and TLS fields translate to rule variables in to-rule: client.asn, client.as_org, tls.ja3, tls.ja4, tls.version, tls.sni, http.ja4h (request.ja4h) and referer.host (request.referer_host). Response fields (status, server, timings), tls.cipher and the stored-only enrichment fields (city, device, browser) are refused.

sh
waap analytics top -by client.asn -q 'outcome = blocked' -since 7d -n 20
waap analytics series -by attack.class -source events -bucket 1h
waap analytics validate -q 'path ^= "/api/" and status >= 500'
waap analytics to-rule -q 'client.asn = 64666 and path ^= "/login"'

Errors map to the API statuses:

  • 400: bad filter, field or range.
  • 403: field not available to your role, or application outside your scope.
  • 429: busy or over the per-user budget (default 60 queries a minute). The answer says when to retry.
  • 504: timed out.

The limits are the analytics settings (waap settings get analytics). Queries are not written to the audit log. to-rule drafts are.

waap filters ​

Manages the saved filters you may see: your own, and shared ones.

sh
waap filters list|show|create|edit|delete
  • show ID: one filter. list prints ID, name, source, owner, visibility and version.
  • create -name N -q FILTER [-source traffic|events] [-range -24h] [-columns a,b] [-description D] [-visibility private|shared]: saves a filter. It is private unless -visibility shared is given. Sharing needs the operator role with access to every application.
  • edit [flags of create] [-version N] ID: changes only the flags given. The version defaults to the one just read. A stale version is refused (409).
  • delete [-version N] ID.
sh
waap filters create -name "Blocked logins" -q 'path ^= "/login" and outcome = blocked' -range -24h -visibility private
waap filters edit -description "Blocked logins, last day" ID

waap dashboards ​

Manages dashboards.

sh
waap dashboards list|show|templates|create|edit|delete|duplicate|export|import
  • list: lists dashboards.
  • show ID: prints the document as JSON.
  • templates: lists the built-in starters.
  • create -name N (-template T | -f FILE) [-visibility private|shared]: creates a dashboard from a template, or from a JSON file in the form export writes (name, visibility, doc). -f - reads standard input.
  • edit [-f FILE] [-name N] [-visibility V] [-version N] ID: replaces the document, renames it, or changes who sees it. The version defaults to the one just read.
  • delete [-version N] ID.
  • duplicate [-name N] ID: makes a private copy.
  • export [-o FILE] ID: writes the dashboard as JSON to standard output, or to FILE.
  • import -f FILE [-name N] [-visibility V]: creates a new dashboard from an exported document.
sh
waap dashboards create -name "Edge health" -template T
waap dashboards export -o edge-health.json ID
waap dashboards import -f edge-health.json -name "Edge health copy"

Rules:

  • Your own private items are always allowed.
  • Shared items need the operator role with access to every application.
  • Limits: 200 shared dashboards and 500 shared saved filters in the cluster, 100 private items per user besides, 24 widgets per dashboard, and 64 KiB per document.