tsitsishvili/elastic-audit
A Laravel package for Elasticsearch-backed audit logging. Capture Eloquent model changes and application events, store structured audit records in Elasticsearch, and search or analyze activity trails at scale with a simple, scalable setup.
Architecture fit
tsitsishvili/elastic-audit is a Laravel-side audit trail package that ships audit events from application code into Elasticsearch. As a service-provider-based Laravel package it slots into the framework's normal configuration/publishing model (config file, facade or injected writer, queued writes), so it does not require architectural change to the host application beyond wiring a new audit channel.
v4.2.0 strengthens the package's fit for regulated or security-sensitive workloads in three ways:
Integration feasibility
Low-to-moderate effort for a greenfield adoption; moderate for existing 4.1.x consumers. The release is a minor version with no declared breaking changes, so Composer-level adoption should be a constraint bump plus composer update. The real work is downstream, not in the package install:
guzzlehttp/guzzle transitively via HTTP clients, SDKs, and Elasticsearch clients. Expect to resolve a constraint conflict in some applications and to re-run the HTTP integration test suite after resolution.dynamic: false mappings, new fields will be dropped or rejected. Consumers must confirm index template/mapping updates land before or with the application deploy, and must verify that field-level security or index permissions allow the new fields.Technical risk
Key questions
Stack fit Assumes a Laravel application (service provider + config publishing), PHP 8.x, Composer, and an Elasticsearch cluster reachable from the application tier. Fits naturally wherever the team already treats Elasticsearch as the observability/audit backend; introduces a second write path (and a second availability dependency) where it does not. Because audit writes are on the request path by default unless queued, the package's placement relative to the request lifecycle is an architectural decision, not a configuration detail.
Migration path
elastic-audit, note current pinned version (target 4.1.x → 4.2.0), and identify any that have not yet adopted 4.x.composer why guzzlehttp/guzzle and a dry-run update against 4.2.0 across the estate before committing anything. Classify apps as "clean," "conflict-resolvable," "blocked."4.2.0) rather than a caret range for the first adoption cycle; loosen after the pilot proves stable.Compatibility Verify against the matrix that actually matters for the estate: PHP minor, Laravel major (and the supported floor), Guzzle major, Elasticsearch server major, and the Elasticsearch PHP client version the package pulls in. Server-side mapping compatibility is the constraint most likely to bite, because it is invisible until documents stop arriving.
Sequencing Mappings/templates → downstream consumers (dashboards, SIEM parsers) → dependency resolution → application code upgrade in canary → wider rollout. Do not invert this: upgrading code before mappings means a window where provenance fields are silently dropped, which is exactly the evidence you would need if that window contained an incident.
Maintenance Routine and low-ceremony at the package level — minor version, no declared deprecations, dependency bumps handled by Dependabot. The maintenance load is mostly on the consumer side: keeping index templates in sync with the package's document schema, and keeping the Elasticsearch cluster version inside the supported range. Budget recurring effort for schema-drift review each time the package adds fields, and note that single-maintainer projects warrant an internal fork-or-vendor contingency plan given the compliance role this package plays.
Support Support boundary needs to be explicit before this becomes an audit-of-record system: who owns cluster availability, who owns mapping drift, who responds when audit writes fail at 2 a.m. The new failure observability is only valuable if it is wired into that on-call path — an alert that no one receives is the same as no alert. Confirm the maintainer's responsiveness and security-disclosure process; for a package in the audit path, a 30-day patch SLA is a reasonable ask.
Scaling Audit volume scales with request volume, and Elasticsearch write throughput, index count, and shard sizing become the binding constraints — not the package. Two scaling decisions to make deliberately:
Failure modes
| Failure | Symptom | Mitigation |
|---|---|---|
| Elasticsearch unreachable | Request latency spikes or exceptions if writes are synchronous | Queue writes; circuit breaker; define degrade-open vs. degrade-closed policy per environment |
| Mapping conflict on new source-identity fields | Documents silently rejected; audit counts diverge from request counts | Apply mappings first; run schema health check; alert on document-count delta |
| Guzzle constraint conflict | Install blocked or unrelated HTTP integration regressions | Pre-flight composer why; re-run HTTP integration tests post-resolution |
| Health check fails closed on boot | Application unavailable because the cluster is unavailable | Run in report-only mode; never let a monitoring feature become an availability dependency |
| Alert fatigue from newly visible failures | On-call ignores audit alerts | Stage rollout; tune thresholds during pilot; route to a named owner |
| Single-maintainer abandonment | No patches for a compliance-critical dependency | Internal fork contingency; version pin; monitor upstream activity |
Ramp-up Estimate roughly one to two engineer-days for the pilot (dependency resolution, mapping updates, deliberate failure testing) and a further half-day per subsequent application, assuming mappings are settled. Team-facing enablement is small but non-zero: engineers need to know that audit writes can fail, how to read the new observability signals, and that a red schema health check is a stop-ship condition rather than background noise.
How can I help you explore Laravel packages today?