Skip to main content
In this lesson, you’ll learn how to configure and inspect Vault’s audit device. We’ll cover:
  • Listing existing audit devices
  • Disabling and re-enabling audit devices
  • Generating audit events
  • Viewing and pretty-printing audit logs
  • Cleaning up when finished
For more details, see the official Vault Audit Device documentation.

Table of Contents

  1. List Existing Audit Devices
  2. Disable an Audit Device
  3. Enable the File Audit Device
  4. Generate Audit Events
  5. View and Pretty-Print Audit Logs
  6. Disable the File Audit Device

1. List Existing Audit Devices

To see which audit devices are currently enabled, run:
Example output:

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:
Output:

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:
Output:
Ensure the log file appears in your working directory:
Sample result:

4. Generate Audit Events

Perform common Vault operations to create log entries:
  1. List all enabled secrets engines:
  2. Write a KV secret:
  3. Delete the secret:
  4. 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:
You’ll see entries like:

Pretty-Print with jq

For easier reading, pipe through jq:
Example of a request/response entry:
Example of a KV delete operation:

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:
Output:

Summary of Commands


Watch Video

Practice Lab