Command

nylas audit export

Export audit logs to JSON or CSV for compliance, analysis, or backup.

Usage

nylas audit export [-o FILE] [--format json|csv] [--since DATE]

Flags

FlagDescription
--jsonOutput as JSON
--no-colorDisable color output
--verbose(-v)Enable verbose output
--configCustom config file path
--help(-h)Show help for the command
--limitLimit results (most list commands)
--yes(-y)Skip confirmations
--output(-o)Output file path (default: stdout)
--formatExport format: json or csv (default: json)
--sinceExport entries after this date
--untilExport entries before this date
--limit(-n)Maximum number of entries to export

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 --since "2024-01-01" --until "2024-02-01" -o january.json

Pipe 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 --force

Troubleshooting

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.

Recommended guides

Run nylas audit export --help for full help output.