Audit Log Export Adapter
Component Detail
Infrastructure
medium complexity
backend
1
Dependencies
0
Dependents
1
Entities
0
Integrations
Description
Handles streaming serialization of audit log entries to CSV and JSON formats for download. Processes large datasets as a stream to avoid memory exhaustion on high-volume exports. Applies column mapping and field sanitization appropriate to each export format.
audit-log-export-adapter
Responsibilities
- Stream-serialize audit log entries to CSV with proper escaping
- Stream-serialize audit log entries to JSON (newline-delimited or array format)
- Apply field-level sanitization and column header mapping per format
- Set appropriate HTTP response headers for file download
Interfaces
streamToCsv(logStream: AsyncIterable<AuditLogEntry>, res: Response): Promise<void>
streamToJson(logStream: AsyncIterable<AuditLogEntry>, res: Response): Promise<void>
buildCsvHeaders(): string[]
serializeEntry(entry: AuditLogEntry, format: ExportFormat): string