elkadrey/laravel-log-viewer
Lightweight Laravel/Lumen log viewer. Install via Composer, register the service provider, and add a route to LogViewerController@index to browse your app logs in the browser. No public assets or vendor routes; supports rotated logs.
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Log Rotation Gaps | Medium | Test with logrotate and Laravel’s single vs. daily log channels. May need custom log retention policies. |
| Performance | Low | UI renders logs client-side; risk of high memory usage if viewing large log files (>100MB). Add pagination or lazy-loading. |
| Security | Medium | Logs may contain PII/sensitive data. Restrict access via middleware (e.g., auth:sanctum + IP whitelisting). |
| Custom Log Formats | High | If using structured logs (JSON), parsing may fail. Extend LogViewerServiceProvider or pre-process logs. |
| Lumen Compatibility | Low | Test in Lumen; may need adjustments for middleware/route binding differences. |
tail -f) or only static files?Monolog processors).composer.json and deploy as part of the Laravel stack.storage/logs/laravel.log).composer require elkadrey/laravel-log-viewer
php artisan vendor:publish --provider="Elkadrey\LogViewer\LogViewerServiceProvider"
log_path, max_files, per_page).Route::middleware(['auth:sanctum'])->get('/logs', [\Elkadrey\LogViewer\Controllers\LogViewerController::class, 'index']);
CanAccessLogs policy).| Component | Compatibility Notes |
|---|---|
| Laravel 4.2–8 | Tested; may need tweaks for L9+. |
| Lumen | Supported but verify middleware/route differences. |
| Log Rotation | Works with logrotate but may miss files if retention policies delete logs. |
| Custom Handlers | Untested with database/syslog handlers. Extend LogViewerServiceProvider if needed. |
| Structured Logs | Assumes plaintext. JSON logs require preprocessing (e.g., Monolog formatter). |
max_files config.elkadrey/laravel-log-viewer alongside Laravel.log_path in config and file permissions (storage/logs/).per_page limit or implement client-side pagination.log_channel).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Log File Corruption | UI shows garbled logs. | Use logrotate with copytruncate. |
| Permission Denied | 403 errors. | Ensure storage/logs/ is writable by web server. |
| Disk Full | Laravel logs fail to write. | Set up log retention policies. |
| UI Freeze (Large Logs) | Client-side rendering hangs. | Add per_page limit or lazy-load. |
| Laravel Update Breaks Viewer | Viewer stops working. | Test compatibility early; fork if needed. |
/logs route.LogViewerController).curl + jq for JSON).How can I help you explore Laravel packages today?