The Laravel adapter
The Laravel adapter mounts the full Log Lens dashboard and JSON API inside an existing Laravel application, so you can browse issues without running the standalone app. It is a thin bridge: all parsing, storage, and API logic runs in the same core engine the standalone app uses. Requires PHP 8.2+ and Laravel 10, 11, or 12.
Install
composer require cliqthemes/log-lens
php artisan vendor:publish --tag=log-lens-assets # UI to public/vendor/log-lens
php artisan vendor:publish --tag=log-lens-config # optional: config/log-lens.php
The service provider is auto-discovered and the UI ships pre-built, so no Node build is required. Visit /log-lens.
How it mounts
The provider registers a single route at the configured prefix (default log-lens), wrapped in the middleware group (default ['web']). One handler serves both the dashboard and the API:
| Request | Result |
|---|---|
No api parameter | Returns the dashboard SPA shell |
Has api parameter | Translated into a core request and dispatched to the engine, returned as JSON |
The SPA calls the API with same-prefix relative URLs, so everything stays under /log-lens.
Authorization
Access is decided by a gate on every request - the host app's auth is the source of truth. No API key is used in Laravel mode. The gate resolves in this order:
- A callback registered via
LogLens::auth(...). - Otherwise a
viewLogLensLaravel Gate, if defined. - Otherwise access is granted only in the
localenvironment - and denied everywhere else, so it fails safe when deployed.
Note that local is open to any browser on the machine, including an incognito tab. Lock it down in a service provider's boot():
use LogLens\Laravel\LogLens;
LogLens::auth(fn ($request) => $request->user()?->can('view-logs') ?? false);
Set LOG_LENS_ENABLED=false to unregister the routes entirely - a hard kill-switch independent of the gate.
Configuration
config/log-lens.php bridges settings into the engine:
route_prefix(defaultlog-lens) andmiddleware(default['web']) - where and how the dashboard and API mount. Add auth middleware (e.g.['web', 'auth']) to redirect guests before the gate runs.root- where the SQLite database andlogs/,processed/,sources/directories live (defaultstorage_path('log-lens')).core- engine settings passed through verbatim: ingested severities (defaultERROR,WARNING), size limits, pagination, connector chunking, SSH defaults, and processed-archive retention.core.auth.tokenis intentionally empty because the gate handles access.
Artisan
php artisan log-lens:import path/to/logs --app=default # streams paths in place; does not move them
php artisan log-lens:sync --app=default # run all connectors
Schedule log-lens:sync in your console kernel for continuous connector ingestion.