- How do I install Log Viewer in Laravel 12?
- Run `composer require opcodesio/log-viewer` and publish the assets with `php artisan log-viewer:publish`. The package auto-registers the `/log-viewer` route, so no manual routing is needed. Ensure your Laravel version (8–13) matches the package’s PHP 8.0+ requirement.
- Can Log Viewer handle large log files (e.g., 5GB+) without performance issues?
- Log Viewer indexes logs on first access, which can be memory-intensive for very large files. For logs over 1GB, consider pre-indexing or archiving older logs. The package supports incremental indexing (v3.24.2+) to mitigate cold-start delays, but monitor memory usage in production.
- Does Log Viewer support custom log formats (e.g., JSON logs from a microservice)?
- Yes, you can define custom log parsers by extending the package’s parser system. Use regex or custom logic to parse non-standard formats. Test thoroughly with edge cases like multiline logs or malformed entries, as poorly defined parsers may skip logs or cause errors.
- How do I secure the Log Viewer UI if it’s exposed to untrusted users?
- Restrict access via middleware in `config/log-viewer.php`. For example, add `'middleware' => ['auth:support']` to limit access to authenticated users. Alternatively, use Laravel’s built-in auth gates or IP whitelisting for sensitive environments.
- Will Log Viewer work with Laravel Octane or high-performance servers?
- Yes, Log Viewer is compatible with Octane (v3.24.0+), which includes scoped bindings to reduce conflicts. However, the API endpoint (`/api/logs`) may become a bottleneck under heavy load. Consider rate-limiting or caching responses with Redis if needed.
- Can I use Log Viewer in a Docker/Kubernetes environment?
- Log Viewer works well in containers, but ensure log files are mounted as volumes (e.g., `/var/log` or `storage/logs`). File permissions must allow the web server user (e.g., `www-data`) to read logs. For shared hosting, check PHP’s `memory_limit` and file permissions.
- Does Log Viewer support real-time log streaming (e.g., like Laravel Horizon’s live tail)?
- No, Log Viewer does not offer real-time streaming. It indexes logs on demand and provides search/filter capabilities for historical data. For live logs, consider pairing it with tools like `tail -f` or Horizon’s built-in live tail feature.
- How do I disable or customize the API access in Log Viewer?
- API access is disabled by default. Enable it in `config/log-viewer.php` by setting `'api_enabled' => true`. Customize API routes or rate limits by extending the package’s API service or adding middleware. The API supports folders, files, and log entries.
- Are there alternatives to Log Viewer for Laravel that offer similar features?
- Alternatives include **Laravel Debugbar** (for debugging tools), **Sentry** (error tracking), or **Papertrail** (cloud-based log aggregation). However, Log Viewer stands out for its self-hosted, Laravel-native UI with dark mode, mail previews, and multi-host support without external dependencies.
- How do I handle log files across multiple environments (dev/staging/prod) without conflicts?
- Use the `local_ip_in_hash` setting (v3.18.0+) in `config/log-viewer.php` to ensure log entries are uniquely identified per environment. Avoid sharing the same log files across environments, as this can cause duplicate or mismatched entries in the UI.