- Listing existing audit devices
- Disabling and re-enabling audit devices
- Generating audit events
- Viewing and pretty-printing audit logs
- Cleaning up when finished
Table of Contents
- List Existing Audit Devices
- Disable an Audit Device
- Enable the File Audit Device
- Generate Audit Events
- View and Pretty-Print Audit Logs
- Disable the File Audit Device
1. List Existing Audit Devices
To see which audit devices are currently enabled, run:2. Disable an Audit Device
If you need a clean slate, disable any existing audit device first:Success! Disabled audit device (if it was enabled) at: logs/Verify there are no active audit devices:
3. Enable the File Audit Device
Configure Vault to write audit logs to a local file:Be mindful of disk usage—audit files can grow quickly depending on the volume of requests.
Success! Enabled the file audit device at: file/Confirm it’s active:
4. Generate Audit Events
Perform common Vault operations to create log entries:-
List all enabled secrets engines:
-
Write a KV secret:
-
Delete the secret:
-
Clear the screen to prepare for log inspection:
5. View and Pretty-Print Audit Logs
Raw JSON Output
Audit logs are stored as newline-delimited JSON. To view raw entries:Pretty-Print with jq
For easier reading, pipe throughjq:
6. Disable the File Audit Device
When you’re done, remove the audit device to prevent further log growth:Disabling the audit device stops new entries but does not delete existing logs. Archive or remove them manually if needed.
Success! Disabled audit device (if it was enabled) at: file/Verify no devices remain:
Summary of Commands
| Task | Command |
|---|---|
| List audit devices | vault audit list |
| Disable an audit device | vault audit disable <path> |
| Enable file audit device | vault audit enable file file_path="…/vault_audit.log" |
| Generate sample events | vault kv put / vault kv delete |
| View raw logs | cat vault_audit.log |
| Pretty-print logs | cat vault_audit.log | jq |
| Disable file audit device again | vault audit disable file |