VaultX is a diagnostic and reporting tool for HashiCorp Vault clusters. It helps operators quickly collect health, topology, configuration, and operational details for troubleshooting, validation, and environment review. In version 1.2, VaultX adds a sanitize option that redacts sensitive configuration data so reports and config samples are safer to share with teammates, support, and incident responders.
VaultX is a bash-based CLI tool designed to streamline Vault cluster diagnostics and troubleshooting. It gathers critical information about your Vault deployment including node status, Raft configuration, license details, replication status, and more - making it useful for debugging cluster issues, reviewing environment state, and preparing support data.
- 🔍 Comprehensive Diagnostics: Collects essential Vault cluster information in one command
- 🎨 Colorized Output: Easy-to-read CLI output with color-coded status indicators
- 📊 Pretty-Printed JSON: Export diagnostic data in formatted JSON
- ⚡ Parallel Data Collection: Fast data gathering using parallel execution
- 🔐 Secure Authentication: Supports
VAULT_TOKENenvironment variable or interactive token input - 🛡️ Config Sanitization: Redact or mask sensitive values from Vault config files before sharing
- Node Status: Health and status of all cluster nodes
- Raft Peers: Raft consensus member information
- Operator Members: Cluster member details including versions and roles
- License Information: License expiration and feature flags
- Autopilot State: Automated upgrade and health management status
- Autopilot Config: Autopilot configuration parameters
- Replication Status: DR and Performance replication health
- Audit Devices: Configured audit backends
VaultX requires the following tools to be installed:
vault- HashiCorp Vault CLIjq- JSON processor for parsing and pretty-printingbash- Version 4.0 or higher recommended
- Download the
vaultxscript:
curl -O https://raw.githubusercontent.com/zaid-hc/vaultx/main/vaultx- Make it executable:
chmod +x vaultx- (Optional) Move to a directory in your PATH:
sudo mv vaultx /usr/local/bin/Run with colorized CLI output:
vaultxOutput diagnostics in pretty-printed JSON format:
vaultx -format=jsonExport diagnostic data to a file (automatically pretty-printed):
vaultx -export=diagnostics.jsonDisplay help message:
vaultx -helpUse vaultx sanitize to redact or mask sensitive values from a Vault config file before sharing it with support teams or collaborators. No Vault connection or token is required for this subcommand.
Use vaultx sanitize-logs to mask sensitive values from Vault log files (operational
or audit) before sharing them with support teams. No Vault connection or token is
required.
# Print sanitized log to stdout
vaultx sanitize-logs -log=vault.log
# Positional form (equivalent)
vaultx sanitize-logs vault.log
# Write sanitized output to a file
vaultx sanitize-logs -log=vault-audit.log -out=sanitized-audit.log| Format | Example |
|---|---|
| Operational JSON | {"@timestamp":"...","@level":"info","@message":"...", ...} |
| Audit JSON | {"time":"...","type":"response","request":{"path":"..."}, ...} |
| Syslog + JSON | <syslog-prefix> {"@timestamp":"...", ...} |
| Plain text | 2024-01-15T10:30:00Z [INFO] msg=... |
| Field / Pattern | Treatment |
|---|---|
remote_address |
Host anonymized — x.x.x.50 / x.hashicorp.com |
node_id, node_name |
Identifier masked — x-x-node1 |
cluster_name |
Identifier masked |
request.path / path |
Tail-preserving path mask — .../data/myapp |
client_token |
Kept as-is — already HMAC'd by Vault audit device |
accessor |
Kept as-is — already HMAC'd by Vault audit device |
@timestamp, time |
Kept — structural, not sensitive |
@level, type, @message, error |
Kept |
policies |
Kept |
| Plain-text IPv4 addresses | Host anonymized — x.x.x.50 |
| Plain-text absolute paths (3+ segments) | Tail-preserving path mask |
| Flag | Description |
|---|---|
-log=FILE |
Path to the log file to sanitize (flag form) |
<FILE> |
Path to the log file to sanitize (positional) |
-out=FILE |
Write sanitized output to FILE (default: stdout) |
-help |
Show sanitize-logs help message |
Use vaultx sanitize to redact or mask sensitive values from a Vault config file
before sharing it with support teams. No Vault connection or token is required.
# Print sanitized config to stdout
vaultx sanitize -config=config.hcl
# Positional form (equivalent)
vaultx sanitize config.hcl
# Write sanitized output to a file
vaultx sanitize -config=config.hcl -out=sanitized.hclAll config keys fall into one of four named categories. Keys not explicitly listed are handled by the generic fallback (see below).
| Category | Treatment | Named keys (case-insensitive) |
|---|---|---|
| secret / full-redact | Replaced with ***REDACTED*** |
token, auth_token, api_key, secret, client_secret, kms_key, kms_key_id, private_key, password, access_key, secret_key |
| endpoint / anonymize | Host anonymized; scheme, port, path preserved | vault_addr, api_addr, cluster_addr, cluster_address, address, redirect_addr |
| path / tail-preserve | Leading directories replaced with ...; last two path segments kept |
path, tls_cert_file, tls_key_file, tls_client_ca_file, tls_ca_file, ca_cert, ca_path, cert_file, key_file, pid_file, log_file, file_path, audit_log_path, config_file |
| identifier / token-mask | Leading delimiter-separated tokens replaced with x; suffix kept |
cluster_name, node_id, node_name, region, availability_zone |
Special case —
pathinside asecretstanza: The sanitizer is block-aware. When apathkey appears directly inside asecret "…" { }stanza, its value is fully redacted (***REDACTED***) rather than tail-preserved, because the Vault secret path is itself sensitive.pathin all other stanza types (e.g.storage,seal) retains the normal tail-preserve behaviour.
Custom stanza keys and env-style variable names that do not match any category above are classified by their value content, applied in priority order:
- Key name contains
token,secret,password,passwd, orcredential, or ends with_key→***REDACTED*** - Value looks like a URL or IP address → endpoint/anonymize policy
- Value is an absolute path → path/tail-preserve policy
- Value is a 3-or-more-token hyphen/underscore identifier → identifier/token-mask policy
- Otherwise → passed through unchanged
Keys: vault_addr, api_addr, cluster_addr, cluster_address, address, redirect_addr
| Input | Output |
|---|---|
169.182.4.100 |
x.x.x.100 (last octet preserved) |
hashicorp.com |
hashicorp.com (2-label — unchanged) |
vault.hashicorp.com |
x.hashicorp.com |
prd.ec2.hashicorp.com |
x.x.hashicorp.com |
https://vault.hashicorp.com:8200/v1 |
https://x.hashicorp.com:8200/v1 |
prd.ec2.hashicorp.com:8201 |
x.x.hashicorp.com:8201 |
localhost / 127.0.0.1 / 0.0.0.0 / [::] |
(unchanged) |
[2001:db8::1] |
[x:x::1] (last hextet preserved; prior hextets replaced with x; loopback [::1] and wildcard [::] unchanged) |
[fd00:abcd::10] |
[x:x::10] |
Keys: path, tls_cert_file, tls_key_file, tls_client_ca_file, tls_ca_file, ca_cert, ca_path, cert_file, key_file, pid_file, log_file, file_path, audit_log_path, config_file
Each leading directory segment is replaced with ...; the last two segments are kept.
Paths with two or fewer segments are passed through unchanged.
| Input | Output |
|---|---|
/etc/ssl/vault/server.key |
.../.../vault/server.key |
/opt/vault/tls/tls.crt |
.../.../tls/tls.crt |
/opt/vault/data |
.../vault/data |
/vault/data |
/vault/data (≤ 2 segments — unchanged) |
C:\vault\tls\server.key |
...\tls\server.key (Windows paths also supported) |
Keys: cluster_name, node_id, node_name, region, availability_zone
Uses the first delimiter found (- takes priority over _).
Rule: keep the last half (rounded up) of tokens, replace the first half (rounded down) with x.
Single-token values (no delimiter) are passed through unchanged.
| Input | Output |
|---|---|
vault-prod-eu-west-1 |
x-x-eu-west-1 (N=5, mask 2, keep 3) |
us-east-1 |
x-east-1 (N=3, mask 1, keep 2) |
prod-cluster-01 |
x-cluster-01 (N=3, mask 1, keep 2) |
my_app_prod_us_east |
x_x_prod_us_east (N=5, underscore delimiter, mask 2) |
production |
production (single token — unchanged) |
Config before:
vault_addr = "https://vault.hashicorp.com:8200"
api_addr = "https://prd.ec2.hashicorp.com:8200"
cluster_name = "vault-prod-eu-west-1"
token = "s.abc123"
tls_cert_file = "/etc/ssl/vault/tls.crt"
tls_key_file = "/etc/ssl/vault/server.key"
seal "awskms" {
region = "us-east-1"
kms_key_id = "arn:aws:kms:us-east-1:123:key/abcd"
access_key = "AKIAIOSFODNN7EXAMPLE"
secret_key = "wJalrXUtnFEMI/K7MDENG"
}Config after vaultx sanitize:
vault_addr = "https://x.hashicorp.com:8200"
api_addr = "https://x.x.hashicorp.com:8200"
cluster_name = "x-x-eu-west-1"
token = "***REDACTED***"
tls_cert_file = ".../.../vault/tls.crt"
tls_key_file = ".../.../vault/server.key"
seal "awskms" {
region = "x-east-1"
kms_key_id = "***REDACTED***"
access_key = "***REDACTED***"
secret_key = "***REDACTED***"
}Note: Telemetry-specific bespoke masking rules are deferred to a future release. Custom telemetry keys are handled by the generic fallback today.
| Flag | Description |
|---|---|
-format=json |
Output in pretty-printed JSON format |
-export=FILE |
Export data to specified file |
-help |
Show help message |
| Flag | Description |
|---|---|
-config=FILE |
Path to the config file to sanitize (flag form) |
<FILE> |
Path to the config file to sanitize (positional) |
-out=FILE |
Write sanitized output to FILE (default: stdout) |
-help |
Show sanitize help message |
vaultx.mov
VaultX supports two authentication methods:
- Environment Variable (recommended):
export VAULT_TOKEN="your-vault-token"
vaultx- Interactive Prompt:
vaultx
# You'll be prompted: "Enter your Vault token:"VAULT_TOKEN- Vault authentication tokenVAULT_ADDR- Vault server address (e.g., https://vault.example.com:8200)VAULT_SKIP_VERIFY- Skip TLS certificate verification (not recommended for production)
Discovering Vault cluster nodes...
Discovered nodes:
https://vault-node-1:8200
https://vault-node-2:8200
https://vault-node-3:8200
=== Vault Status for https://vault-node-1:8200 ===
Key Value
--- -----
Seal Type shamir
Initialized true
Sealed false
...
=== Raft List Peers ===
Node Address State Voter
---- ------- ----- -----
node-1 10.0.1.10:8201 leader true
node-2 10.0.1.11:8201 follower true
node-3 10.0.1.12:8201 follower true
{
"node_status": {
"https://vault-node-1:8200": {
"type": "shamir",
"initialized": true,
"sealed": false,
"ha_enabled": true,
"is_self": true,
"active_time": "2024-01-15T10:30:00Z"
}
},
"raft_peers": {
"cli_parsed": [
{
"node": "node-1",
"address": "10.0.1.10:8201",
"state": "leader",
"voter": "true"
}
]
},
"operator_members": {...},
"license": {...},
"autopilot_state": {...},
"autopilot_config": {...},
"replication": {
"dr_status": {...},
"performance_status": {...}
},
"audit_devices": {...}
}Install the required tools:
# Install Vault CLI
# See: https://developer.hashicorp.com/vault/downloads
# Install jq
# macOS
brew install jq
# Ubuntu/Debian
apt-get install jq
# RHEL/CentOS
yum install jq- Verify your VAULT_TOKEN is valid
- Check that VAULT_ADDR points to the correct Vault server
- Ensure network connectivity to the Vault cluster
Ensure your Vault token has sufficient permissions to read:
sys/healthsys/license/statussys/replication/dr/statussys/replication/performance/statussys/audit
The VaultX AI Agent adds a Python-based conversational layer on top of the existing bash diagnostic tool. It uses Ollama with open-source LLMs (default: llama3.1:8b) — everything runs locally with no external API calls and no cost.
User ↔ vaultx-agent (Python CLI) ↔ LLM (Ollama/local)
↔ vaultx (bash tool) ↔ Vault API
- Python 3.11+
- Ollama installed and running (
ollama serve) - The default model pulled:
ollama pull llama3.1:8b - The same
VAULT_ADDR/VAULT_TOKENenvironment variables used by the bash tool
- Create a virtual environment and install the Python dependencies:
python3 -m venv venv && source venv/bin/activate && pip3 install -r agent/requirements.txt- Make the entry-point script executable (if not already):
chmod +x vaultx-agentStart a conversational Q&A session about your Vault cluster:
./vaultx-agentExample questions:
- "Is my cluster healthy?"
- "Are any nodes sealed?"
- "When does my license expire?"
- "Summarize the raft peers"
- "Are there any replication issues?"
Type refresh to re-collect diagnostic data, or quit / Ctrl-C to exit.
Automatically collect all diagnostics, analyze them with the LLM, and produce a comprehensive Markdown report:
./vaultx-agent --generate-reportSave the report to a file:
./vaultx-agent --generate-report -o report.md
# or
./vaultx-agent -r -o report.md| Flag | Default | Description |
|---|---|---|
--generate-report, -r |
— | Generate a support ticket report instead of interactive mode |
--model MODEL |
llama3.1:8b |
Ollama model to use |
--ollama-host HOST |
http://localhost:11434 |
Ollama server URL |
--output FILE, -o FILE |
stdout | Save report to FILE (used with --generate-report) |
--help |
— | Show help message |
You can also run the agent as a Python module:
python -m agent.cli --helpThe generated Markdown report includes:
- Cluster Overview — node count, versions, topology
- Health Assessment — overall status, per-node sealed/active/standby
- Raft Consensus — leader, voter list, unhealthy nodes
- License Status — expiration date and warnings
- Replication — DR and Performance replication status
- Audit Devices — configured backends
- Findings & Recommendations — prioritized list (CRITICAL / WARNING / INFO)
- Raw Diagnostic Data — full JSON appendix
agenty/
├── __init__.py # Package metadata
├── cli.py # CLI entry point
├── llm.py # Ollama LLM client wrapper
├── tools.py # Tool definitions wrapping vaultx -format=json
├── prompts.py # System prompts and templates
├── report.py # Report generation logic
└── requirements.txt # Python dependencies
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is open source and available under the MIT License.
For issues, questions, or contributions, please visit the GitHub repository.
- ✅ Added
sanitizesubcommand for redacting sensitive Vault configuration values - ✅ Added
sanitize-logssubcommand for Vault operational and audit log sanitization - ✅ Supports operational JSON, audit JSON, syslog+JSON, and plain-text log formats
- ✅ Masks
remote_address,node_id,node_name,cluster_name, andrequest.pathin logs - ✅ Keeps
client_tokenandaccessoras-is (already HMAC'd by Vault audit device) - ✅ Masks plain-text IPv4 addresses and deep absolute paths in non-JSON log lines
- ✅ Improved README documentation with sanitize usage and examples
- ✅ Added automatic JSON pretty-printing with
jq - ✅ Updated CLI flags to use single dash convention
- ✅ Improved error handling
- Initial release
- Multi-node cluster support
- Colorized CLI output
- JSON export functionality
- Parallel data collection
Note: VaultX is designed for diagnostic purposes. Review collected or sanitized output before sharing it, even when using the sanitize option.