Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Yammi Audit Log Laravel Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Distributed Laravel Systems: Yammi excels in queue-heavy, multi-job workflows where traditional audit logs fail to trace execution chains (e.g., HTTP → Job → Job → Model). Its provenance chain (actor/origin/correlation) aligns perfectly with event-sourced or CQRS-like architectures where causality matters.
  • Multi-Tenancy: Built-in support for tenant-aware auditing (via middleware or model binding) makes it ideal for SaaS platforms.
  • Compliance-Centric: GDPR, tamper-evidence (hash chains), and subject-access reports address regulatory needs without forcing architectural changes.
  • Observability: Anomaly detection and SIEM streaming integrate with existing monitoring (e.g., Datadog, Splunk) for incident response.

Misalignment:

  • Non-Eloquent Writes: Raw SQL/Query Builder updates require explicit AuditLog::record() calls, which may not fit high-throughput or legacy systems.
  • No Event Sourcing: While it offers a "time machine," it’s read-only forensics, not a source of truth for replaying state.

Integration Feasibility

  • Zero-Model Setup: No traits/observers → minimal migration risk. Global listener on Eloquent events ensures backward compatibility.
  • Async Writes: AUDIT_LOG_WRITE_ASYNC=true decouples audit logging from business logic, reducing write contention.
  • Dedicated Database: Supports separate schema/connection for audit data, isolating performance impact.
  • Laravel Ecosystem: Works with Laravel 9–13, PHP 8.1+, and any supported database (MySQL, PostgreSQL, SQLite).

Challenges:

  • Legacy Systems: If using raw SQL or non-Eloquent ORMs, additional instrumentation is needed.
  • Queue Workers: Requires context propagation (e.g., correlation_id in job payloads) for accurate tracing across workers.

Technical Risk

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:

  1. How will we handle non-Eloquent writes (e.g., raw SQL, GraphQL mutations)?
  2. What’s the acceptable latency for async writes? (Configurable via AUDIT_LOG_WRITE_ASYNC.)
  3. Do we need tamper-evidence? (Enables audit-log:verify but adds storage overhead.)
  4. How will we manage retention? (Default 180 days; can be extended or archived.)

Key Questions for Stakeholders

  1. Compliance: Do we need GDPR subject-access reports or tamper-proof audit trails?
  2. Incident Response: Is execution chain reconstruction critical for post-mortems?
  3. Performance: Can we tolerate ~1–2ms overhead per write (configurable via sampling)?
  4. Observability: Should we integrate with SIEM tools (e.g., Splunk, Datadog) for alerts?
  5. Multi-Tenancy: Do we need tenant-isolated audit logs?

Integration Approach

Stack Fit

  • Laravel Core: Designed for Eloquent, Queues, and Middleware (e.g., auth, web).
  • Database: Works with MySQL/PostgreSQL/SQLite; supports dedicated schema/connection.
  • Async Workers: Requires context propagation (e.g., correlation_id in job payloads).
  • Monitoring: SIEM streaming and anomaly detection integrate with existing tools.

Compatibility Notes:

  • Laravel 9–13: Tested on PHP 8.1+; no breaking changes expected.
  • Non-Eloquent: Raw SQL/Query Builder updates need explicit AuditLog::record().
  • Legacy Code: Minimal impact if using global listeners (no model changes).

Migration Path

  1. Assessment Phase:
    • Audit current logging (e.g., Spatie, custom tables).
    • Identify critical workflows needing provenance (e.g., payments, user actions).
  2. Pilot Deployment:
    • Install in staging with AUDIT_LOG_UI_ENABLED=false.
    • Test queue-heavy workflows (e.g., order processing).
  3. Gradual Rollout:
    • Enable async writes (AUDIT_LOG_WRITE_ASYNC=true).
    • Configure sampling for high-churn models.
    • Roll out dashboard (audit-log:ui enable) post-validation.
  4. Advanced Features:
    • Enable tamper-evidence (AUDIT_LOG_INTEGRITY=true) for critical data.
    • Integrate SIEM alerts for anomalies.

Rollback Plan:

  • Disable via AUDIT_LOG_CAPTURE_MODE=none (configurable at runtime).
  • No data loss; audit logs are append-only.

Sequencing

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

Compatibility Matrix

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

Operational Impact

Maintenance

  • Low Overhead:
    • No model changes required (zero setup).
    • Auto-migrations handle schema updates.
  • Configuration-Driven:
    • Retention, sampling, and async writes are runtime-configurable.
    • Dashboard settings editable without redeploy.
  • Dependency Risk:
    • Single package with MIT license; no external services (except optional SIEM).

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

Support

  • Debugging:
    • Provenance chain simplifies incident analysis (e.g., "Who triggered this payment?").
    • Time machine reconstructs past states for debugging.
  • Alerting:
    • Slack/webhook alerts for anomalies (e.g., unexpected model changes).
    • SIEM integration for centralized monitoring.
  • User Queries:
    • Dashboard provides self-service access to audit data.
    • JSON API enables programmatic queries.

Common Support Scenarios:

  1. Incident Response: "Why did Order #42 change status?" → Trace provenance chain.
  2. Compliance Audits: "Provide GDPR subject data." → Use audit-log:gdrp command.
  3. Performance Issues: "Audit logs are slowing writes." → Enable async mode.

Scaling

  • Write Scaling:
    • Async writes decouple audit logging from
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky