Skip to content

Viewing Operation History

The log command displays the history of secrets operations from the audit log.

View the full log in chronological order (oldest first):

Terminal window
kanuka secrets log

Output:

2024-01-15 10:30:00 [email protected] encrypt .env, .env.local
2024-01-15 10:35:00 [email protected] register [email protected]
2024-01-15 11:00:00 [email protected] revoke [email protected]
2024-01-15 11:30:00 [email protected] sync 3 users, 5 files

Show only entries from a specific user:

Terminal window
kanuka secrets log --user [email protected]

Show only specific operation types:

Terminal window
# Single operation
kanuka secrets log --operation encrypt
# Multiple operations (comma-separated)
kanuka secrets log --operation register,revoke

Filter entries by date range:

Terminal window
# Entries after a date
kanuka secrets log --since 2024-01-01
# Entries before a date
kanuka secrets log --until 2024-01-31
# Entries within a range
kanuka secrets log --since 2024-01-01 --until 2024-01-31

Filters can be combined:

Terminal window
kanuka secrets log --user [email protected] --operation encrypt --since 2024-01-01

Show only the last N entries:

Terminal window
kanuka secrets log -n 10

Show most recent entries first (like git log):

Terminal window
kanuka secrets log --reverse

Combine with -n to get the N most recent entries:

Terminal window
kanuka secrets log --reverse -n 5

The default format shows timestamp, user, operation, and details in columns:

2024-01-15 10:30:00 [email protected] encrypt .env, .env.local

Use --oneline for a more compact format:

Terminal window
kanuka secrets log --oneline

Output:

2024-01-15 [email protected] encrypt 2 files

For scripting and automation, output as a JSON array:

Terminal window
kanuka secrets log --json

Output:

[
{"ts":"2024-01-15T10:30:00.123456Z","user":"[email protected]","uuid":"a1b2c3d4","op":"encrypt","files":[".env",".env.local"]},
{"ts":"2024-01-15T10:35:00.456789Z","user":"[email protected]","uuid":"b2c3d4e5","op":"register","target_user":"[email protected]"}
]

See what happened in the last week:

Terminal window
kanuka secrets log --since $(date -v-7d +%Y-%m-%d) --reverse

Review all actions by a specific user:

Terminal window
kanuka secrets log --user [email protected]

Track who has been added or removed:

Terminal window
kanuka secrets log --operation register,revoke

Get recent activity as JSON for processing:

Terminal window
kanuka secrets log --json -n 100 | jq '.[] | select(.op == "encrypt")'

If the audit log doesn’t exist or is empty, you’ll see an appropriate message:

Terminal window
# No log file
$ kanuka secrets log
No audit log found. Operations will be logged after running any secrets command.
# Empty log
$ kanuka secrets log
No audit log entries found.