Download the PHP package edwinekr/otel-elk-laravel without Composer
On this page you can find all versions of the php package edwinekr/otel-elk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download edwinekr/otel-elk-laravel
More information about edwinekr/otel-elk-laravel
Files in edwinekr/otel-elk-laravel
Package otel-elk-laravel
Short Description OpenTelemetry activity logging integration with ELK Stack for Laravel applications
License MIT
Informations about the package otel-elk-laravel
OpenTelemetry ELK Laravel
OpenTelemetry activity logging integration with ELK Stack (Elasticsearch, Logstash, Kibana) for Laravel applications.
Architecture
Features
- 🚀 Automatic HTTP Request Logging - All requests are logged with response time, status codes, and user info
- 🔐 Authentication Event Logging - Login, logout, failed attempts, lockouts, and password resets
- 📊 Model Activity Logging - Track create, update, and delete operations on Eloquent models
- 🎯 Custom Activity Logging - Log any custom activity with metadata
- ⚡ Async Logging - Non-blocking log submission for better performance
- 🔒 Sensitive Data Masking - Automatically redact passwords, tokens, and other sensitive fields
- 🌍 GeoIP Ready - Works with Logstash GeoIP filter for location visualization in Kibana
Requirements
- PHP 8.0+
- Laravel 10.x, 11.x, or 12.x
- Guzzle HTTP Client
Installation
Install the package via Composer:
The package will auto-register its service provider.
Publish Configuration
This will create config/activity_log.php in your application.
Configuration
Add the following to your .env file:
Usage
Automatic HTTP Request Logging
All HTTP requests are automatically logged when the middleware is enabled. No additional code required!
Manual Activity Logging
Use the ActivityLog facade or inject ActivityLogService:
Using Dependency Injection
Model Activity Logging
Use the LogsActivity trait on your Eloquent models:
You can also log custom activities on a model:
Authentication Events
Authentication events are automatically logged when enabled. These events are tracked:
auth.login- User logged inauth.logout- User logged outauth.failed- Login attempt failedauth.lockout- User was locked outauth.registered- New user registeredauth.password_reset- Password was reset
Real User Monitoring (RUM)
This package includes Elastic APM RUM (Real User Monitoring) support for browser-side performance monitoring and error tracking.
RUM Configuration
Add the following to your .env file:
Using the RUM Blade Component
Add the RUM script to your layout file (before closing </head> tag):
The component will only render when RUM is enabled (ELASTIC_APM_RUM_ENABLED=true) and a valid server URL is configured.
Using the RUM Facade
For more control, use the Rum facade:
Using the RUM Helper
You can also use the helper class directly:
Distributed Tracing Origins
To enable distributed tracing between frontend and backend, configure the origins in config/activity_log.php:
Publishing RUM Views
To customize the RUM script template:
This will publish the views to resources/views/vendor/otel-elk/.
Using Session-Based User Resolver
If your application uses session-based authentication instead of Laravel's built-in auth:
Make sure your session contains user data:
Manual Middleware Registration
If you prefer to register the middleware manually, disable auto-registration:
Then register it in your routes or kernel:
Or for Laravel 11+ in bootstrap/app.php:
Excluding Paths and Methods
Configure excluded paths in config/activity_log.php:
Sensitive Fields
Sensitive fields are automatically masked in request body logs:
Logstash Configuration
Example Logstash configuration for receiving logs:
Kibana Visualization
After logs are ingested, you can create visualizations in Kibana:
- Go to Kibana → Maps
- Click Add layer → Documents
- Select your index pattern
activity-logs-* - Choose
geoip.locationas the geospatial field - Configure tooltips to show:
ip,user_email,action,path
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of otel-elk-laravel with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0