Wazuh Commands
Overview
The netapi wazuh command group provides CLI access to Wazuh SIEM via OpenSearch (Indexer) and Wazuh Manager API.
Service Endpoints
| Service | VIP | Port | Purpose |
|---|---|---|---|
Dashboard |
10.50.1.132 |
443 |
Web UI |
Indexer |
10.50.1.131 |
9200 |
OpenSearch API |
Manager |
10.50.1.134 |
55000 |
REST API |
Manager |
10.50.1.134 |
1515 |
Agent registration (authd) |
Manager |
10.50.1.134 |
514 |
Syslog (UDP/TCP) |
Workers |
10.50.1.133 |
1514 |
Agent event data |
Prerequisites
Credentials Location
Wazuh credentials are stored in gopass:
# Indexer (OpenSearch)
gopass show v3/domains/d000/k3s/wazuh
# Manager API
gopass show v3/domains/d000/k3s/wazuh-api
Required Environment Variables
| Variable | Description | Default |
|---|---|---|
|
OpenSearch URL |
|
|
OpenSearch username |
|
|
OpenSearch password |
Required (no default) |
|
Manager API URL |
|
|
Manager API username |
|
|
Manager API password |
Required for |
Index Commands
indices
List Wazuh indices in OpenSearch:
netapi wazuh indices
Index Docs Size Status -------------------------------------------------------------------------------- wazuh-alerts-4.x-2026.02.24 58 369.7kb green wazuh-archives-4.x-2026.02.24 1097 329kb green wazuh-statistics-2026.9w 70 228.8kb green
Filter by pattern:
netapi wazuh indices --pattern "wazuh-alerts-*"
Archive Search
archives
Search Wazuh archives (syslog events, system events):
netapi wazuh archives
| Option | Short | Description |
|---|---|---|
|
|
Search text in full_log field |
|
|
Filter by source IP/hostname |
|
|
Time range (1h, 24h, 7d) |
|
|
Max results (default: 20) |
|
Show raw JSON output |
# Last hour (default)
netapi wazuh archives
# pfSense firewall logs
netapi wazuh archives -q filterlog
# From specific source, last 24h
netapi wazuh archives -l 10.50.1.1 -t 24h
# Blocked connections
netapi wazuh archives -q "block" -n 50
Found 5 results (showing up to 5) [2026-02-24T03:58:28] 10.50.1.1 Feb 23 19:58:28 filterlog[50531]: 65,,,12004,ixl0,match,block,in,4,0x0,,64... [2026-02-24T03:58:01] df -P ossec: output: 'df -P': tmpfs
Alert Commands
alerts
Search Wazuh alerts:
netapi wazuh alerts
| Option | Short | Description |
|---|---|---|
|
|
Filter by rule ID |
|
|
Minimum severity level (1-15) |
|
|
Filter by agent name |
|
|
Time range (default: 24h) |
|
|
Max results |
|
Show raw JSON output |
# All alerts, last 24h
netapi wazuh alerts
# High severity only (level 8+)
netapi wazuh alerts --level 8
# Specific agent
netapi wazuh alerts --agent vault-01
# Specific rule
netapi wazuh alerts --rule 100200
Found 10 alerts [2026-02-24T03:58:39] L2 R522 wazuh-manager-master-0 File with world writable permissions found. [2026-02-24T03:45:12] L10 R100201 wazuh-manager-master-0 pfSense: Potential port scan detected
rules
Show alert statistics by rule (most triggered):
netapi wazuh rules
| Option | Short | Description |
|---|---|---|
|
|
Time range (default: 24h) |
|
|
Top N rules (default: 20) |
# Top 20 rules, last 24h
netapi wazuh rules
# Top 50 rules, last week
netapi wazuh rules --top 50 -t 7d
Rule Level Count Description -------------------------------------------------------------------------------- 522 2 20 File with world writable permissions found. 100200 3 15 pfSense: Firewall block 5501 3 8 Login session opened
Source Analysis
sources
Show syslog sources in archives:
netapi wazuh sources
| Option | Short | Description |
|---|---|---|
|
|
Time range (default: 24h) |
Syslog sources (last 24h, 1,097 total events) Source Events % ------------------------------------------------------- 10.50.1.1 895 81.6% df -P 176 16.0% rootcheck 20 1.8% wazuh-monitord 6 0.5%
Manager API Commands
These commands require WAZUH_API_USER and WAZUH_API_PASSWORD environment variables.
|
agents
List Wazuh agents:
netapi wazuh agents
ID Name IP Status OS -------------------------------------------------------------------------------- 000 wazuh-manager-master-0 127.0.0.1 Active Rocky Linux 9 001 vault-01 10.50.1.60 Active Rocky Linux 9 002 kvm-01 10.50.1.99 Active Arch Linux
Dashboard Management
Manage Wazuh/OpenSearch Dashboards programmatically via the Saved Objects API.
dashboard-list
List saved dashboards:
netapi wazuh dashboard-list
Found 5 dashboards ID Title ---------------------------------------------------------------------------------- 7adfa750-4c81-11e8-b3d7-01146121b73d Wazuh - Security Events e3166a70-4dd6-11e8-8a36-9f1c4a4a2ed4 Wazuh - Integrity Monitoring 0d44db00-4e37-11e8-a85e-2f0e2cf89fc7 Wazuh - Vulnerability Detection
Show raw JSON:
netapi wazuh dashboard-list --raw
dashboard-export
Export dashboards to NDJSON file (includes referenced visualizations, index patterns):
# Export all dashboards
netapi wazuh dashboard-export
# Custom output file
netapi wazuh dashboard-export -o wazuh-backup-2026-02-25.ndjson
# Export specific dashboard
netapi wazuh dashboard-export -i 7adfa750-4c81-11e8-b3d7-01146121b73d -o security-events.ndjson
Exported 47 objects to dashboards.ndjson File size: 125,432 bytes
dashboard-import
Import dashboards from NDJSON file:
# Import (skip existing)
netapi wazuh dashboard-import dashboards.ndjson
# Overwrite existing
netapi wazuh dashboard-import backup.ndjson --overwrite
✓ Imported 47 objects
Workflow: Backup and Restore
# 1. List current dashboards
netapi wazuh dashboard-list
# 2. Export all dashboards (backup)
netapi wazuh dashboard-export -o /backup/wazuh-dashboards-$(date +%F).ndjson
# 3. After disaster/reinstall, import
netapi wazuh dashboard-import /backup/wazuh-dashboards-2026-02-25.ndjson --overwrite
Workflow: Dashboard as Code
Version control your dashboards:
# 1. Create dashboard manually in Wazuh UI
# 2. Export to repo
netapi wazuh dashboard-export -o dashboards/custom-security.ndjson
# 3. Commit to git
git add dashboards/custom-security.ndjson
git commit -m "feat(wazuh): Add custom security dashboard"
# 4. Deploy to another Wazuh instance
netapi wazuh dashboard-import dashboards/custom-security.ndjson
curl Equivalents
For scripting without netapi:
# List dashboards
curl -sk -u admin:$WAZUH_INDEXER_PASSWORD \
"https://wazuh.inside.domusdigitalis.dev:443/api/saved_objects/_find?type=dashboard" | jq
# Export all dashboards
curl -sk -u admin:$WAZUH_INDEXER_PASSWORD \
-X POST "https://wazuh.inside.domusdigitalis.dev:443/api/saved_objects/_export" \
-H "osd-xsrf: true" \
-H "Content-Type: application/json" \
-d '{"type": "dashboard", "includeReferencesDeep": true}' \
> dashboards.ndjson
# Import dashboards
curl -sk -u admin:$WAZUH_INDEXER_PASSWORD \
-X POST "https://wazuh.inside.domusdigitalis.dev:443/api/saved_objects/_import" \
-H "osd-xsrf: true" \
--form file=@dashboards.ndjson
Quick Reference
| Command | Description |
|---|---|
|
List all Wazuh indices |
|
Search pfSense logs |
|
High severity alerts |
|
Syslog source summary |
|
Top triggered rules |
|
List agents (requires API creds) |
|
List saved dashboards |
|
Export dashboards to NDJSON |
|
Import dashboards from NDJSON |
Validation Checklist
1. Verify Connectivity
# Test indexer
curl -sk -u admin:$(gopass show -o v3/domains/d000/k3s/wazuh) \
"https://10.50.1.131:9200/_cluster/health" | jq -r '.status'
# Expected: green
# Test manager API
curl -sk -u wazuh-wui:$(gopass show -o v3/domains/d000/k3s/wazuh-api) \
"https://10.50.1.134:55000/security/user/authenticate" | jq -r '.data.token' | head -c 20
# Expected: JWT token prefix
2. Verify Agents
# Via netapi (with credentials)
WAZUH_INDEXER_PASSWORD="$(gopass show -o v3/domains/d000/k3s/wazuh)" \
WAZUH_API_USER="wazuh-wui" \
WAZUH_API_PASSWORD="$(gopass show -o v3/domains/d000/k3s/wazuh-api)" \
netapi wazuh agents
# Via kubectl
ssh k3s-master-01 "kubectl exec -n wazuh wazuh-manager-master-0 -- /var/ossec/bin/agent_control -l"
Troubleshooting
"Required: WAZUH_INDEXER_PASSWORD"
Credentials not loaded. Export manually:
# Option 1: Load via dsource (permanent - recommended)
dsource d000 dev/observability
# Option 2: Export manually (temporary)
export WAZUH_INDEXER_PASSWORD="$(gopass show -o v3/domains/d000/k3s/wazuh)"
export WAZUH_API_USER="wazuh-wui"
export WAZUH_API_PASSWORD="$(gopass show -o v3/domains/d000/k3s/wazuh-api)"
Deployment Status
| Host | Type | Method | Status |
|---|---|---|---|
wazuh-manager-master-0 |
Manager |
Self |
✓ Active (ID: 000) |
vault-01 |
Rocky Linux |
Agent |
Pending |
bind-01 |
Rocky Linux |
Agent |
Pending |
kvm-01 |
Rocky Linux |
Agent |
Pending |
ipa-01 |
Rocky Linux |
Agent |
Pending |
keycloak-01 |
Fedora |
Agent |
Pending |
k3s-master-01 |
Rocky Linux |
Agent |
Pending |
home-dc01 |
Windows 2025 |
Agent |
Pending |
modestus-razer |
Arch Linux |
Agent |
Pending |
pfSense-01 |
FreeBSD |
Syslog |
✓ Active (895 events) |
ise-01 |
ISE 3.4 |
Syslog |
✓ Active (10.50.1.134:514) |
C9300/3560CX |
IOS-XE |
Syslog |
Not configured |