Huawei Cloud WAF Query Skill
Overview
This skill helps users query Huawei Cloud Web Application Firewall (WAF) protection data for daily security inspection and incident troubleshooting:
- Attack events — list attack events by time range, attack type, protection action and domain, and view event details
- Access / protection logs — page through WAF access (event) logs
- Attack statistics — overall counts grouped by attack category (ACCESS / WEB_ATTACK / CC / PRECISE / CRAWLER / BOTM / BLACK_IP / ATTACK)
- Threat overview — threat summary for a recent period (yesterday / today / 3days / 1week / 1month)
- Top attack source IPs — ranking of the most frequent attack source IPs in a time window
All operations are read-only queries (List/Show). No resource is created, modified or deleted.
Prerequisites
-
KooCLI (hcloud) installed and authenticated — see
references/cli-installation-guide.md. -
WAF service permission — the IAM account needs WAF read permissions, see
references/iam-policies.md. -
Project ID — required by most WAF APIs. Obtain it from the Huawei Cloud console (username → My Credentials → Projects) or use:
hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --name=cn-north-4 -
Region — WAF queries must specify a region, e.g.
cn-north-4. -
Time parameters
from/toare millisecond timestamps and must be used together; the maximum time range is 30 days.
Workflow
- Confirm the target time window — compute
from/tomillisecond timestamps (e.g. last 24 hours). For "today / 3 days" style summaries,ListThreats --recentacceptsyesterday|today|3days|1week|1monthdirectly. - Get an overview first — run
ListStatisticsto see the attack distribution, then drill down withListEvent. - List attack events —
ListEventwith filters (attack type, action, domain, time range). - Inspect a specific event —
ShowEvent --eventid=<id>for full detail of a suspicious event. - Check logs / rankings —
ListEventLogfor access logs,ListTopIpfor top source IPs,ListThreatsfor the threat summary.
Core Commands
List attack events
hcloud WAF ListEvent --cli-region=cn-north-4 --project_id={project_id} \
--from={from_ms} --to={to_ms} [--attacks.1={attack_type}] \
[--actions.1={action}] [--domains.1={domain}] --pagesize={page_size}
--attacks.1values:xss,sqli,rfi,lfi,cmdi,cc,webshell,vuln,botm,robot,antitamper,antileakage,custom_blackip,custom_geoip,illegal, etc.--actions.1values:block,pass,log,captcha,js_challenge, etc.--domains.Nis the array form for domain filtering (repeatable, e.g.--domains.1=example.com --domains.2=other.com). Do NOT use--domain(singular): it collides with the KooCLI system parameter of the same name and triggers an interactive confirmation, which fails with[USE_ERROR]EOFin non-interactive (Agent) execution.pagesizecannot be-1; at most 10,000 records can be queried.
Show attack event detail
hcloud WAF ShowEvent --cli-region=cn-north-4 --project_id={project_id} --eventid={event_id}
List access / protection logs
hcloud WAF ListEventLog --cli-region=cn-north-4 --project_id={project_id} --page={page} --pagesize={size}
Attack statistics overview
hcloud WAF ListStatistics --cli-region=cn-north-4 --project_id={project_id} --from={from_ms} --to={to_ms}
Threat overview (recent period)
hcloud WAF ListThreats --cli-region=cn-north-4 --project_id={project_id} --from={from_ms} --to={to_ms} --recent={yesterday|today|3days|1week|1month}
Top attack source IPs
hcloud WAF ListTopIp --cli-region=cn-north-4 --project_id={project_id} --from={from_ms} --to={to_ms}
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
--cli-region |
Yes | Huawei Cloud region | cn-north-4 |
--project_id |
Yes | Project ID of the WAF instance | 0dd8cb4e... |
--from / --to |
Yes (ListEvent/ListStatistics/ListThreats/ListTopIp) | Start/end time, millisecond timestamps, used together, max range 30 days | 1786885834203 |
--recent |
Yes (ListThreats) | Recent period keyword | today, 3days, 1week |
--attacks.[N] |
No | Attack type filter (repeatable) | --attacks.1=sqli |
--actions.[N] |
No | Protection action filter (repeatable) | --actions.1=block |
--domains.[N] |
No | Domain name filter, array form (repeatable, fuzzy match) | --domains.1=example.com |
--eventid |
Yes (ShowEvent) | Attack event ID | e6c2d8e1... |
--page / --pagesize |
No | Paging for ListEventLog | --page=1 --pagesize=10 |
KooCLI Command Format Standard
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]
- Service name:
WAF - Operation name: PascalCase, e.g.
ListEvent,ShowEvent,ListStatistics - Region parameter:
--cli-region=<value>(e.g.cn-north-4) - Simple parameter:
--key=value(e.g.--eventid=xxx) - Indexed array parameter:
--key.N=value(e.g.--attacks.1=sqli)
Reference Documents
references/cli-installation-guide.md— KooCLI installation and authenticationreferences/iam-policies.md— Least-privilege IAM policies for WAF read-only accessreferences/verification-method.md— How to verify the skill worksreferences/dataflow-diagram.md— Mermaid data flow diagramreferences/acceptance-criteria.md— Acceptance criteria for this skillreferences/related-commands.md— Command quick reference
Edge Cases
| Scenario | Handling |
|---|---|
ListEvent returns 0 events |
Verify from/to are valid millisecond timestamps and the range ≤ 30 days; confirm the WAF instance has protected domains |
ListThreats returns [USE_ERROR] for --recent |
--recent only accepts yesterday, today, 3days, 1week, 1month |
Missing --project_id |
Obtain the project ID via hcloud IAM KeystoneListProjects --cli-region=<region> --name=<region> |
pagesize set to -1 on ListEvent |
Not allowed; use a positive integer (max 100) |
ShowEvent with a non-existent eventid |
Returns {"total": 0, "items": []} silently (no error) — treat it as "event not found", verify the event ID is valid and still within the retention period |
| Query range > 30 days | Split into multiple queries with sub-ranges |
| No WAF instance in the account | The API returns empty lists (total: 0) — confirm WAF is enabled and domains are added |
