What does nylas audit export do?
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. Pipe to stdout by default, or save to a file with -o. Supports SOC 2 and internal audit workflows.
Usage
nylas audit export [-o FILE] [--format json|csv] [--since DATE]Flags
| Flag | Description |
|---|---|
| --json | Output as JSON |
| --no-color | Disable color output |
| --verbose(-v) | Enable verbose output |
| --config | Custom config file path |
| --help(-h) | Show help for the command |
| --limit | Limit results (most list commands) |
| --yes(-y) | Skip confirmations |
| --output(-o) | Output file path (default: stdout) |
| --format | Export format: json or csv (default: json) |
| --since | Export entries after this date |
| --until | Export entries before this date |
| --limit(-n) | Maximum number of entries to export |
Examples
Export to JSON file
nylas audit export -o audit-logs.jsonExport as CSV
nylas audit export --format csv -o audit-logs.csvExport date range
nylas audit export --since "2024-01-01" --until "2024-02-01" -o january.jsonPipe to jq for analysis
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 --forceExample output
✓ Exported 142 entries to audit.json
Format: json
Range: 2024-01-01 to 2024-01-31Troubleshooting
Export file is empty
Check that audit logs exist with `nylas audit logs show`. Verify the date range if using --since/--until.
CSV formatting issues
Some fields contain commas. Use --format json for complex log data or a proper CSV parser.
Related commands
nylas audit config set
Set an audit configuration value. Valid keys: retention_days, max_size_mb, rotate_daily, compress_old, log_request_id, log_api_details.
nylas audit config show
Show the current audit configuration, including log path, retention, rotation, and compression settings.
nylas audit init
Initialize audit logging for the Nylas CLI. Creates the log directory, default configuration, and optionally enables logging immediately.
nylas audit logs clear
Clear all audit log entries. This is a destructive action — consider exporting logs first with `nylas audit export`.
nylas audit logs disable
Disable audit logging. Stops recording CLI activity to the audit log file.
nylas audit logs enable
Enable audit logging. Records all CLI activity to a local log file for compliance and debugging.
Recommended guides
Thunderbird vs Nylas: GUI vs CLI email
Thunderbird is a desktop GUI email client with OAuth and calendar built in. Compare it to a scriptable, headless CLI for servers, cron jobs, and AI agents.
Pipedream vs Nylas for Email Automation
Pipedream wires 3,000+ apps with event workflows and code steps. Nylas is a native email API with a CLI for agents and cron. Compare as a Pipedream alternative.
Detect Calendar Conflicts from the CLI
Spot double-booked meetings and overlapping events from the terminal. AI conflict detection and jq scripts catch calendar conflicts before they derail your day.
Block Focus Time on Your Calendar (CLI)
Context-switching costs 23 minutes of focus per interruption. Block focus time on Google Calendar from your terminal so meetings can't eat your deep-work slots.
Build a Strands Email Agent
Give a Strands Agents SDK agent email access using the Nylas CLI as a @tool. One function reaches Gmail, Outlook, and 4 more providers — no OAuth code needed.
Cloudflare Agents Email Tools
Use the Cloudflare Agents SDK to build a stateful email agent on Workers — connect to the Nylas MCP server over HTTP and call email tools in TypeScript.
Run nylas audit export --help for full help output.
