Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Log Viewer Laravel Package

shaonmajumder/log-viewer

Beautiful, secure Laravel log viewer for Laravel 9–11 and PHP 8+. Auto-discovers log files, highlights levels, supports themes, search and level filtering, context expansion, tail mode, auto-refresh, and downloading full or filtered output.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Monolithic vs. Modular: The package is a self-contained Laravel module with minimal external dependencies, making it a lightweight addition to existing Laravel applications. It does not enforce architectural patterns (e.g., DDD, Hexagonal) but integrates seamlessly into traditional MVC Laravel stacks.
  • Log-Centric Design: Specialized for Laravel’s log files (laravel.log, rotated logs), reducing complexity for teams already using Laravel’s logging system. Avoids reinventing the wheel for generic log parsing.
  • UI/UX Layer: Introduces a new frontend component (Blade views) without requiring a full frontend framework (e.g., Vue/React), aligning with Laravel’s server-rendered approach.

Integration Feasibility

  • Laravel Compatibility: Supports Laravel 9–11 and PHP 8+, covering most active Laravel projects. No breaking changes to core Laravel systems (e.g., logging, auth).
  • Dependency Conflicts: Minimal risk due to isolated scope (only Laravel core and PHP). No database migrations or model changes required.
  • Route/URL Conflicts: Resolved in v0.0.28 with explicit route_name_prefix (e.g., log.viewer.) to avoid collisions with host routes like laravel.log.*.
  • Auth Integration: Flexible auth handling (custom callbacks, middleware, session fallbacks) accommodates Laravel’s auth diversity (e.g., Sanctum, Jetstream, custom guards).

Technical Risk

  • Security: Hardened against path traversal and unauthorized access, but production exposure requires explicit safeguards (e.g., auth_required=true, allowed_emails). Default public access (v0.0.17) is a critical risk for unconfigured installs.
  • Performance: Log parsing is client-side (JavaScript) for filtering/context, which could strain large log files (>100MB). Tail mode (real-time) may impact server resources if logs are frequently written.
  • Customization: Limited theming/layout hooks; overriding Blade views requires manual template publishing. No API for programmatic log access (e.g., CLI tools).
  • Maintenance: Single maintainer (1-star repo) and infrequent updates (last release: 2023-09-23) introduce long-term viability concerns. No CI/CD or automated testing evidence.

Key Questions

  1. Security Hardening:
    • How will access be restricted in production? (e.g., IP whitelisting, admin middleware, or allowed_emails).
    • Are logs stored in non-standard locations (e.g., S3, custom paths)? If so, does the package support them?
  2. Scalability:
    • What is the expected log file size? Will client-side filtering handle it, or is server-side preprocessing needed?
    • Is real-time tailing required, or is periodic polling sufficient?
  3. Customization Needs:
    • Are there plans to extend the UI (e.g., custom columns, log annotations)? If so, how will Blade views be overridden?
    • Is integration with existing monitoring tools (e.g., Sentry, Datadog) required?
  4. Alternatives:
    • Would a headless log API (e.g., exposing logs via a custom endpoint) be preferable to embedded UI?
    • Are there existing tools (e.g., Laravel Debugbar, Ray) that already meet needs?
  5. Long-Term Support:
    • What is the backup plan if the package becomes unmaintained? Can logs be exported to a supported format (e.g., JSON) for third-party tools?

Integration Approach

Stack Fit

  • Laravel Ecosystem: Ideal for Laravel apps using Monolog for logging. No conflicts with Laravel’s default logging stack.
  • Auth Systems: Works with:
    • Laravel’s built-in auth (session/cookie-based).
    • Token-based auth (Sanctum, Passport) via middleware.
    • Custom auth (e.g., API tokens, session payloads) with fallback logic.
  • Frontend: Pure Blade templates with minimal JS (no build step required). Compatible with:
    • Traditional Laravel apps (no SPAs).
    • Apps using Inertia.js/Vue/React (if Blade views are embedded).
  • Deployment: Stateless (no database or external services). Can be deployed alongside Laravel without infrastructure changes.

Migration Path

  1. Discovery:
    • Audit current log access methods (e.g., SSH, tail, custom tools).
    • Identify log locations (default: storage/logs/laravel.log).
  2. Installation:
    composer require shaonmajumder/log-viewer
    php artisan vendor:publish --tag=log-viewer-config
    php artisan vendor:publish --tag=log-viewer-views
    
  3. Configuration:
    • Update config/log-viewer.php:
      'auth_required' => env('LOG_VIEWER_AUTH_REQUIRED', true),
      'allowed_emails' => ['admin@example.com'],
      'middleware' => ['web', 'auth.admin'], // Custom middleware
      'route_prefix' => 'admin', // e.g., /admin/log-viewer
      
  4. Testing:
    • Verify routes (/log-viewer) and auth (e.g., auth.admin middleware).
    • Test filtering (levels, search, context) with sample logs.
  5. Deployment:
    • Add to CI/CD pipeline (no additional steps beyond Laravel deployments).
    • Monitor performance with large log files.

Compatibility

  • Laravel Versions: Tested on 9–11; validate with your version.
  • PHP Extensions: None required beyond Laravel’s defaults.
  • Log Formats: Supports Monolog’s default format. Custom formats may need preprocessing (e.g., via Laravel’s Log::extend()).
  • Caching: No built-in caching; consider Laravel’s cache for log file paths if rotated frequently.

Sequencing

  1. Phase 1 (Pilot):
    • Install in a staging environment.
    • Test with a subset of logs (e.g., laravel.log only).
    • Validate auth and filtering.
  2. Phase 2 (Rollout):
    • Extend to rotated logs (laravel-*.log) via config.
    • Integrate with monitoring (e.g., alert on ERROR logs).
  3. Phase 3 (Optimization):
    • Adjust middleware/auth for production.
    • Explore server-side log preprocessing for large files.

Operational Impact

Maintenance

  • Package Updates: Monitor for updates (low frequency; manual composer update).
  • Configuration Drift: Published config (log-viewer.php) may need updates if package defaults change (e.g., auth behavior).
  • View Overrides: Custom Blade views must be republished if package updates templates (e.g., UI controls in v0.0.13).
  • Dependencies: No external services; updates limited to PHP/Laravel versions.

Support

  • Troubleshooting:
    • Auth Issues: Check middleware, auth_required, and allowed_emails.
    • Log Discovery: Verify log paths in config/log-viewer.php or override LogViewerServiceProvider.
    • Performance: For large logs, consider server-side filtering (e.g., custom controller logic).
  • Documentation: Limited but sufficient for basic use. May need internal runbooks for:
    • Custom auth setups.
    • Log format deviations.
  • Vendor Risk: Single maintainer; mitigate by:
    • Forking the repo for critical fixes.
    • Exporting logs to a supported format (e.g., JSON) for third-party tools.

Scaling

  • Log Volume:
    • Small/Medium: Client-side filtering handles <100MB logs.
    • Large: Preprocess logs (e.g., tail -f + grep) or use server-side filtering (custom controller).
  • Concurrency: Stateless; no scaling limits beyond Laravel’s web server (e.g., Nginx, Apache).
  • Real-Time: Tail mode uses polling (configurable refresh rates). For true real-time, consider WebSockets (not supported).

Failure Modes

Scenario Impact Mitigation
Log file corruption UI errors, missing logs Backup logs; validate file paths.
Auth misconfiguration Unauthorized access Enforce auth_required=true + middleware.
Large log files Slow UI, timeouts Pre-filter logs server-side.
Package abandonment No updates, security risks Fork or export logs to alternative.
Route conflicts 404 errors Use route_name_prefix.
Theme/JS failures Broken UI Fallback to default theme.

Ramp-Up

  • Developer Onboarding:
    • Time: 1–2 hours to install and configure.
    • Skills: Basic Laravel (routes, middleware, Blade).
    • Training: Document auth setup and log path customization.
  • End-User Training:
    • Time: 5–10 minutes to learn filtering/context tools.
    • Features: Highlight search, tail mode, and download options.
  • Internal Adoption:
    • Pilot with DevOps/SRE teams first.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky