Command

nylas audit export

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

Written by Qasim Muhammad Staff SRE

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

FlagDescription
--jsonOutput as JSON
--no-colorDisable color output
--verbose(-v)Enable verbose output
--configCustom config file path
--help(-h)Show help for the command
--limit(-n)Maximum number of entries to export
--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

Examples

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.

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

Example output

✓ Exported 142 entries to audit.json
  Format: json
  Range: 2024-01-01 to 2024-01-31

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.