DEV Community

Qasim Muhammad
Qasim Muhammad

Posted on

How nylas audit export Works: Export audit logs to JSON or CSV for compliance, analysis, or backup

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]
Enter fullscreen mode Exit fullscreen mode

Examples

Export to JSON file:

nylas audit export -o audit-logs.json
Enter fullscreen mode Exit fullscreen mode

Export as CSV:

nylas audit export --format csv -o audit-logs.csv
Enter fullscreen mode Exit fullscreen mode

Export date range:

nylas audit export | jq '[.[] | .command] | group_by(.) | map({command: .[0], count: length})'
Enter fullscreen mode Exit fullscreen mode

Backup before clearing:

nylas audit export -o backup-$(date +%Y%m%d).json
nylas audit logs clear --force
Enter fullscreen mode Exit fullscreen mode

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)