romalytar/yammi-audit-log-laravel
Audit log for Laravel that tracks full provenance of every change: actor, origin, and correlation ID across queues and services. Built for distributed, queue-heavy apps to trace who triggered a write and through what execution chain.
Misalignment:
AuditLog::record() calls, which may not fit high-throughput or legacy systems.AUDIT_LOG_WRITE_ASYNC=true decouples audit logging from business logic, reducing write contention.Challenges:
correlation_id in job payloads) for accurate tracing across workers.| Risk Area | Mitigation Strategy |
|---|---|
| Performance Overhead | Batched inserts, async writes, and sampling (e.g., ignore high-churn models). |
| Data Integrity | Tamper-evident hashes and signed digests for critical data. |
| Schema Changes | Auto-migrations are idempotent; no downtime required. |
| Context Leakage | Secrets redaction (e.g., password, api_key) and PII handling via config. |
| Dashboard Bloat | UI is opt-in and rate-limited; can be disabled entirely. |
Critical Questions:
AUDIT_LOG_WRITE_ASYNC.)audit-log:verify but adds storage overhead.)auth, web).correlation_id in job payloads).Compatibility Notes:
AuditLog::record().AUDIT_LOG_UI_ENABLED=false.AUDIT_LOG_WRITE_ASYNC=true).audit-log:ui enable) post-validation.AUDIT_LOG_INTEGRITY=true) for critical data.Rollback Plan:
AUDIT_LOG_CAPTURE_MODE=none (configurable at runtime).| Phase | Tasks | Dependencies |
|---|---|---|
| Prep | Backup DB, review current logging, update composer.json. |
None |
| Install | composer require romalytar/yammi-audit-log-laravel, php artisan migrate. |
Laravel 9+ |
| Configure | Set AUDIT_LOG_WRITE_ASYNC, retention, and sampling rules. |
Migration complete |
| Test | Validate provenance in queue workflows, edge cases (impersonation, raw SQL). | Config in place |
| Monitor | Check performance impact, dashboard usability, and alert accuracy. | Pilot deployment |
| Scale | Enable multi-tenancy, SIEM integration, or tamper-evidence. | Stable pilot |
| Component | Supported | Workarounds |
|---|---|---|
| Eloquent Models | ✅ Full support | None |
| Raw SQL/Query | ⚠️ Manual AuditLog::record() |
Explicit instrumentation required |
| Queue Jobs | ✅ Context propagation needed | Pass correlation_id in payload |
| Laravel Middleware | ✅ Actor/origin resolution | Uses auth and web middleware |
| Multi-Tenancy | ✅ Built-in | Configure via tenant() helper |
| GDPR | ✅ Subject-access reports | Enable via config |
Maintenance Tasks:
| Task | Frequency | Owner |
|---|---|---|
| Retention cleanup | Daily (cron) | DevOps |
| Schema updates | Rare (migrations) | Backend Team |
| Dashboard monitoring | Weekly | QA/DevOps |
| Anomaly rule tuning | As needed | SRE |
Common Support Scenarios:
audit-log:gdrp command.How can I help you explore Laravel packages today?