ipsumlab / laravel-log-viewer
Add a quick, hidden logs reading page to your projects in one click.
Requires
- php: ^8.1
- illuminate/http: ^10.0|^11.0
- illuminate/routing: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
This package is not auto-updated.
Last update: 2026-04-21 12:49:53 UTC
README
A beautiful, zero-config log viewer for Laravel. Adds a configurable route to your application that displays all log files with filtering, search, and charts — so you can inspect logs directly from the browser without ever accessing the server. The route can be protected with any Laravel middleware, including auth.
Features
- 📁 Lists all
.logfiles instorage/logs/ - 🔍 Full-text search across log messages
- 🎯 Filter by log level (emergency, critical, error, warning, info, debug)
- 📊 Charts: level distribution (donut) + timeline (bar chart) via Chart.js
- 🗑️ Delete or clear log files from the UI
- 📄 Paginated entries (newest first)
- ⚙️ Configurable URL prefix, middleware, file size limits
- 🎨 Dark terminal UI — no CSS framework needed
Installation
1. Install via Composer
composer require ipsumlab/laravel-log-viewer
Laravel auto-discovers the service provider via
composer.jsonextra. No manual registration needed.
2. (Optional) Publish the config
php artisan vendor:publish --tag=log-viewer-config
This creates config/log-viewer.php where you can customize the URL, middleware, and more.
3. (Optional) Publish views to customize them
php artisan vendor:publish --tag=log-viewer-views
Usage
Visit http://yourapp.test/logs in your browser.
Configuration
After publishing, edit config/log-viewer.php:
return [
// URL prefix — change to whatever you want
'route_prefix' => env('LOG_VIEWER_PREFIX', 'logs'),
// Middleware — add 'auth' to protect the route
'middleware' => ['web'],
// 'middleware' => ['web', 'auth'],
// Files larger than this (MB) are flagged as too large to parse
'max_file_size_mb' => env('LOG_VIEWER_MAX_SIZE', 50),
// Allow deleting log files from the UI
'allow_delete' => env('LOG_VIEWER_ALLOW_DELETE', true),
// Allow clearing log files from the UI
'allow_clear' => env('LOG_VIEWER_ALLOW_CLEAR', true),
// Log entries per page
'per_page' => env('LOG_VIEWER_PER_PAGE', 50),
];
Or use .env variables:
LOG_VIEWER_PREFIX=dev-logs
LOG_VIEWER_MAX_SIZE=100
LOG_VIEWER_ALLOW_DELETE=false
LOG_VIEWER_PER_PAGE=100
Protecting the Route
To require authentication, add auth to the middleware array:
// config/log-viewer.php
'middleware' => ['web', 'auth'],
For more granular access control (e.g. admin-only):
'middleware' => ['web', 'auth', 'can:view-logs'],
Package Structure
laravel-log-viewer/
├── composer.json
├── config/
│ └── log-viewer.php # Published to config/log-viewer.php
├── resources/
│ └── views/
│ └── index.blade.php # Main UI
├── routes/
│ └── web.php # Package routes
├── src/
│ ├── LogViewerServiceProvider.php
│ ├── LogReader.php # Core log parsing service
│ └── Http/
│ └── Controllers/
│ └── LogViewerController.php
└── tests/
License
MIT