Vault's audit subsystem records every API request and response as tamper-evident JSON. The standard Ops design is to centralize that stream into Syslog and forward it onward to a SIEM or log platform.
This article walks through how to choose between the file and socket audit devices, then aggregate the output with rsyslog or syslog-ng, all aligned with the official specs. Version-sensitive details are called out, and key talking points for the Ops-track certification exam are highlighted.
Vault can have multiple audit devices enabled simultaneously on the same node. The common pattern is to emit JSON audit logs on each node and collect/forward them with a local syslog daemon (rsyslog/syslog-ng). This loosely couples Vault's availability from the log collection responsibility.
There are two main aggregation patterns into Syslog: (1) write locally with the file audit device and collect via the syslog file-input module; (2) write directly to /dev/log (unixgram) with the socket audit device for immediate syslog ingestion. Both are stable patterns documented officially.
| Approach | Strengths | Watch-outs | Representative configuration |
|---|---|---|---|
| File audit device + rsyslog imfile | Stable and easy to debug. File-tail collection resists drops. | Rotation and I/O monitoring required. Watch permissions and SELinux. | vault audit enable file file_path=/var/log/vault_audit.log |
| Socket audit device → /dev/log (unixgram) | Low latency via kernel buffer. No disk needed. | If syslog stops, you get backpressure. Mind the /dev/log socket type. | vault audit enable socket type=unixgram path=/dev/log |
| Socket audit device → 127.0.0.1:1514 (UDP/TCP) | Can ship beyond localhost. Connects directly to a forwarder. | Vulnerable to network outages. Use only within trusted zones. | vault audit enable socket type=udp address=127.0.0.1:1514 |
Typical Vault audit log aggregation patterns into Syslog
Alternative: Vault (socket unixgram) → /dev/log → rsyslog → SIEM
Listing audit devices in detail
vault audit list -detailedThe most portable approach is to emit JSON via the file audit device and collect it with rsyslog's imfile module. With well-designed I/O and rotation, it is resistant to drops and easy to troubleshoot.
Configure rsyslog as a simple serial pipeline: input (imfile) → optional reformatting → remote forwarding (TLS recommended). Since Vault already emits JSON, reformatting is usually unnecessary.
Representative Vault + rsyslog configuration
# Vault: enable the file audit device (never use log_raw in production)
vault audit enable -path=file file file_path=/var/log/vault_audit.log mode=0600
# Sanity check (generate an entry)
vault kv put secret/demo foo=bar
tail -n1 /var/log/vault_audit.log
# rsyslog: ingest with imfile, forward to a central syslog over TLS (/etc/rsyslog.d/50-vault.conf)
module(load="imfile")
input(type="imfile" File="/var/log/vault_audit.log" Tag="vault" Severity="info" Facility="local6")
action(type="omfwd" Target="syslog.example.com" Port="6514" Protocol="tcp" StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name" StreamDriverPermittedPeers="syslog.example.com")
# Enable queues as needed
# action(type="omfwd" ... queue.type="LinkedList" queue.size="10000" queue.filename="vault_audit")When you want to hand off to syslog without going through disk, use the socket audit device to write to /dev/log (unixgram). On most Linux distributions /dev/log is a datagram (unixgram) socket. rsyslog or syslog-ng receives it and applies standard filter/forward rules.
Option names and supported transports can vary by version. The examples below are representative. Unix domain sockets use path, while UDP/TCP use address with type. Always confirm the developer documentation for the version you run before going to production.
Socket audit device configuration examples
# Send to /dev/log (the standard syslog endpoint on most Linux distros)
vault audit enable -path=syslog socket type=unixgram path=/dev/log
# Send to the local rsyslog UDP port
vault audit enable -path=udp1514 socket type=udp address=127.0.0.1:1514
# Verify
vault audit list -detailed
# Triage (e.g. temporarily listen on UDP 1514 locally)
sudo nc -ul 1514With the file approach, nail down the rotation strategy. copytruncate avoids reopening the process but can briefly drop entries under extreme load. To play it safe, leave plenty of disk headroom and add queues to stabilize forwarding.
The socket approach avoids disk, but if the receiver stalls, backpressure flows back to Vault and can impact request processing in the worst case. Syslog daemon queues, robust TCP/TLS forwarding, and retry configuration are essential.
logrotate template (copytruncate example; tune for your environment)
/var/log/vault_audit.log {
daily
rotate 14
compress
missingok
notifempty
copytruncate
create 0600 vault vault
}Vault audit logs HMAC sensitive values such as secret payloads and token IDs. This curbs leakage risk from the logs while still letting you correlate matching values via identical hashes. A staple exam question is "Are plaintext values stored in audit logs?" The answer: not unless log_raw=true is set.
You cannot reverse the hashes during investigation, but the vault audit hash command lets you HMAC a given input with the same algorithm and compare against values in the log.
Hash-matching example (an investigation workflow)
# Example: compute the HMAC of 'bar' against the 'file/' audit device
vault audit hash file/ value=bar
# If the returned hash matches request.data.foo in the audit log, you have a hit
# Search the logs with jq or similar
jq -r 'select(.request.data.foo=="<hash>")' /var/log/vault_audit.logOn Ops-track exams, expect questions on "which audit device to pick," "settings that prevent plaintext secrets," "combining multiple devices in HA," and "the impact of syslog drops." If log_raw=true appears among the options, eliminate it first.
When troubleshooting, isolate quickly by: (1) vault audit list -detailed, (2) confirming reception on the syslog side (/dev/log, UDP/TCP ports), (3) temporarily adding a file device for comparison.
Quick triage procedure
# Current audit device state
vault audit list -detailed
# Enable a temporary file device for comparison
aud_path=$(date +%s)
vault audit enable -path=file-$aud_path file file_path=/var/log/vault_audit_$aud_path.log mode=0600
# Generate an event and confirm it arrives on both sides
vault login -method=token token=<your-token>
tail -n1 /var/log/vault_audit_$aud_path.logOps
問題 1
For a production Vault cluster, which configuration best avoids leaving secrets in plaintext while still being easy to ingest into local syslog?
正解: A
Audit logs are produced only by audit devices. To avoid emitting secrets in plaintext, do not use log_raw; sending via unixgram to /dev/log is well-suited to syslog ingestion. Telemetry is for metrics and is not a substitute for auditing.
Does Vault have a dedicated "syslog audit device"?
Vault officially provides file and socket audit devices as stable options. A dedicated syslog device may not be available or recommended depending on the version, so the typical patterns are file + rsyslog, or socket sending to /dev/log (unixgram). Always check the documentation for your specific version before deploying.
Do I need to configure each node individually in an HA cluster?
Audit devices are replicated across the cluster by default and apply to every node. Specify local=true only when you want to scope a device to a single node (typically for debugging).
How should I design log rotation?
With the file device, copytruncate avoids the need to reopen the process and tends to be stable, but at extreme load it can briefly drop entries. Combine generous disk headroom, rsyslog queues, and TCP/TLS retries on the remote side, and schedule rotation off-peak. Socket devices need no rotation, but receiver queueing and availability design become critical.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...