audit
Hash-chained audit logging with PII detection and compliance export. Events form a cryptographic hash chain per tenant, enabling tamper detection via chain verification. Supports async batching for high throughput.
Used by cmd/worker, cmd/ui.
Usage
import "cruvero/internal/audit"
Key Types / Interfaces
| Type | Source | Description |
|---|---|---|
AuditLogger | logger.go | Interface: Log, Query, VerifyChain, Flush |
AuditEvent | types.go | Immutable audit event with hash chain fields |
PostgresAuditLogger | postgres_logger.go | PostgreSQL-backed logger with async batching and PII detection |
AuditQuery | types.go | Query parameters: tenant, run ID, event types, time range |
ChainBreak | types.go | Hash chain integrity break with position and mismatch details |
LoggerOptions | types.go | Config: buffer size, batch size, flush interval, PII detection |
LoggerStats | types.go | Performance metrics: total logged, flush failures, dropped events |