Export audit logs to JSON or CSV for compliance, analysis, or backup. Essential for SOC 2 compliance and AI agent oversight.
The nylas audit export command writes audit log entries to a JSON or CSV file for compliance reporting, external analysis, or backup before clearing logs. Filter by date range with --since and --until.
Syntax
nylas audit export [-o FILE] [--format json|csv] [--since DATE]
Examples
Export to JSON file:
nylas audit export -o audit-logs.json
Export as CSV:
nylas audit export --format csv -o audit-logs.csv
Export date range:
nylas audit export | jq '[.[] | .command] | group_by(.) | map({command: .[0], count: length})'
Backup before clearing:
nylas audit export -o backup-$(date +%Y%m%d).json
nylas audit logs clear --force
How It Works
Every entry in the audit log captures: the exact command, all arguments (with secrets redacted), the invoker identity (human or AI agent name), the exit code, and a nanosecond timestamp. This level of detail is what compliance auditors expect.
Tips
Combine with other commands: Chain nylas audit export with other Nylas CLI commands using shell pipes and variables for complex workflows.
Debug mode: Add --verbose to see the underlying API requests and responses â useful when something doesn't behave as expected.
Full docs: nylas audit export reference â all flags, advanced examples, and troubleshooting.
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas â other install methods
Top comments (0)