Vault Audit Tools
High-performance command-line tools for analyzing HashiCorp Vault audit logs, written in Rust.
Features
- Fast: 3x faster than equivalent implementations (~17s vs 60s for 4M line logs)
- Memory Efficient: 10x less memory usage through streaming parser
- Multi-File Support: Analyze weeks/months of logs without manual concatenation
- Comprehensive: 16 specialized analysis commands for different use cases
- Production Ready: Tested on 100GB+ multi-day production audit logs
- Shell Completion: Tab completion support for bash, zsh, fish, powershell, and elvish
Installation
From Source
This installs the vault-audit binary to ~/.cargo/bin/.
Pre-built Binaries
Download from the Releases page.
Shell Completion
After installation, enable tab completion for your shell:
Linux/macOS
# Bash (Linux) - single command
&& \
| && \
# Bash (macOS with Homebrew) - single command
&& \
&& \
# Zsh - single command
&& \
&& \
|| && \
|| && \
# Fish - single command
&& \
&& \
# PowerShell (Windows/Cross-platform) - single command
; | ; | ;
Windows (Git Bash)
Git Bash users need special handling since ~ doesn't expand in output redirection:
# Single command installation for Git Bash
&& \
&& \
|| && \
Troubleshooting:
- Use
$HOMEvariable instead of~for paths in Git Bash - If completions don't work immediately, open a new terminal window
- Verify the completion file exists:
ls -la "$HOME/.bash_completions/vault-audit" - Check your shell rc file sources it:
grep vault-audit ~/.bashrc
Commands
System Analysis
system-overview- High-level overview of all operations, entities, and auth methodsentity-gaps- Identify operations without entity IDs (no-entity operations)path-hotspots- Find most accessed paths with optimization recommendations
Authentication Analysis
k8s-auth- Analyze Kubernetes/OpenShift authentication patterns and entity churntoken-operations- Track token lifecycle operations (create, renew, revoke)token-lookup-abuse- Detect excessive token lookup patterns
Entity Analysis
entity-creation- Analyze entity creation patterns by authentication pathentity-churn- Multi-day entity lifecycle tracking across log filesentity-timeline- Generate detailed timeline for a specific entitypreprocess-entities- Extract entity mappings from audit logs
Vault API Integration
client-activity- Query Vault for client activity metrics by mountentity-list- Export complete entity list from Vault (for baseline analysis)
KV Secrets Analysis
kv-summary- Summarize KV secret usage from CSV exportskv-analyzer- Analyze KV usage by path and entity (generates CSV)kv-compare- Compare KV usage between two time periods
Documentation
API Documentation
View the full API documentation with detailed module and function descriptions:
# Generate and open documentation in your browser
The documentation includes:
- Comprehensive crate overview and architecture
- Module-level documentation for all components
- Function-level documentation with examples
- Type definitions and their usage
Once published to crates.io, the documentation will be automatically available at docs.rs/vault-audit-tools.
Command Help
Get detailed help for any command:
# General help
# Command-specific help
Application-Specific
airflow-polling- Analyze Airflow secret polling patterns with burst rate detection
Data Export
token-export- Export token lookup patterns to CSV
Utilities
generate-completion- Generate shell completion scripts
Usage Examples
Quick Analysis
# Get system overview (single file)
# Analyze multiple days without concatenation
# Find authentication issues
# Detect token abuse across multiple files
Multi-File Long-Term Analysis
All audit log commands support multiple files for historical analysis:
# Week-long system overview
# Month-long entity churn tracking
# Multi-day token operations
# Path hotspot analysis across 30 days
Deep Dive Analysis
# Analyze entity creation patterns by auth path
# Track entity lifecycle across multiple days
# Analyze specific entity behavior
# Export token data for further analysis
# Analyze Airflow polling with burst detection
# Query Vault API for client activity metrics
KV Usage Analysis
# Generate KV usage report
# Compare two time periods
# Get summary statistics
Performance
Tested on production audit logs:
Single File:
- Log Size: 15.7 GB (3,986,972 lines)
- Processing Time: ~17 seconds
- Memory Usage: <100 MB
- Throughput: ~230,000 lines/second
Multi-File (7 days):
- Total Size: 105 GB (26,615,476 lines)
- Processing Time: ~2.5 minutes average per command
- Memory Usage: <100 MB (streaming approach)
- Throughput: ~175,000 lines/second sustained
Output Formats
Most commands produce formatted text output with:
- Summary statistics
- Top N lists sorted by volume/importance
- Percentage breakdowns
- Optimization recommendations
CSV export commands generate standard CSV files for:
- Spreadsheet analysis
- Database imports
- Further processing with other tools
Architecture
- Streaming Parser: Processes logs line-by-line without loading entire file into memory
- Efficient Data Structures: Uses HashMaps and BTreeMaps for fast aggregation
- Parallel-Ready: Built with Rust's zero-cost abstractions for future parallelization
- Type Safety: Comprehensive error handling with anyhow
Development
Build
Test
License
MIT
Contributing
Contributions welcome! Please open an issue or PR.
Requirements
- Rust 1.70+ (2021 edition)
- Works on Linux, macOS, and Windows
Support
For issues or questions, please open a GitHub issue.