Search by

munch / filament-logviewer

ClausMunch

A beautiful Filament plugin to view, filter, and manage Laravel log files

Package info

github.com/ClausMunch/filament-logviewer

pkg:composer/munch/filament-logviewer

Statistics

Installs: 51

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.0 2026-03-30 11:16 UTC

This package is auto-updated.

Last update: 2026-10-19 21:54:00 UTC


README

A simple and powerful Filament plugin to view, filter, and manage Laravel log files directly from your admin panel.

Features

  • πŸ“‹ Search, sort and paginate .log and rotated .log.1 files in your configured log directory
  • πŸ“‚ Open a file by clicking its row, or switch files with a searchable picker
  • πŸ” Parse and display log entries with full context
  • 🎯 Filter by log level (emergency, alert, critical, error, warning, notice, info, debug)
  • πŸ“… Filter by date/time range
  • πŸ”Ž Search messages, context, stack traces, timestamps, levels and environments
  • πŸ—‘οΈ Delete individual log files
  • 🧹 Empty log files without deleting them
  • 🎨 Color-coded log levels for easy identification
  • ⚑ Optimized for large log files

Requirements

  • PHP 8.4+
  • Laravel 12.x or 13.x
  • Filament 4.x or 5.x (Filament 5 uses Livewire 4)

Installation

Option A: From Packagist (Recommended)

Install via composer:

composer require munch/filament-logviewer

Option B: Local Development

For local development, add this to your Laravel project's composer.json:

{
  "repositories": [
    {
      "type": "path",
      "url": "../filament-logviewer"
    }
  ]
}

Then require the package:

composer require munch/filament-logviewer:@dev

Usage

Register the plugin in your Filament Panel Provider (e.g., app/Providers/Filament/AdminPanelProvider.php):

use Munch\FilamentLogviewer\FilamentLogviewerPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ... other configuration
            ->plugins([
                FilamentLogviewerPlugin::make(),
            ]);
    }
}

The plugin will automatically register itself and appear in your Filament admin panel navigation under the "Settings" group.

Configuration

Publish the config file (optional):

php artisan vendor:publish --tag="filament-logviewer-config"

Customize the behavior in config/filament-logviewer.php:

return [
    // Path to log files
    'path' => storage_path('logs'),
    
    // Maximum file size to read (10MB default)
    'max_file_size' => 10 * 1024 * 1024,
    
    // Entries per page
    'per_page' => 50,
    
    // Navigation settings
    'navigation' => [
        'group' => 'Settings',
        'sort' => 100,
        'icon' => 'heroicon-o-document-text',
    ],
    
    // Date format
    'date_format' => 'Y-m-d H:i:s',
    
    // Log level colors
    'levels' => [
        'emergency' => ['label' => 'Emergency', 'color' => 'danger'],
        'alert' => ['label' => 'Alert', 'color' => 'danger'],
        'critical' => ['label' => 'Critical', 'color' => 'danger'],
        'error' => ['label' => 'Error', 'color' => 'danger'],
        'warning' => ['label' => 'Warning', 'color' => 'warning'],
        'notice' => ['label' => 'Notice', 'color' => 'info'],
        'info' => ['label' => 'Info', 'color' => 'success'],
        'debug' => ['label' => 'Debug', 'color' => 'gray'],
    ],
];

Features Detail

Log File Management

  • Find Files: Search filenames and sort by name, file size or last modified date. The overview is paginated and shows the newest files first.
  • Delete Logs: Remove individual log files
  • Empty Logs: Clear log file contents without deleting the file

Log Viewing & Filtering

  • Detailed View: Click a file row or "View" to open its entries. Use "Switch file" to search for another filename, or "All log files" to return to the overview.
  • Filter by Level: Select one or more severities, such as error and warning. Combine these with an environment and date range.
  • Date Range Filter: Filter logs by timestamp range
  • Search: Case-insensitive search within the selected file’s loaded entries, including messages, context and stack traces. Search and filters apply before pagination.
  • Navigation: Sort entries by timestamp, level or environment and choose a page size. Click a row or "Details" to view the full entry.
  • Auto-refresh: Tables refresh every 30 seconds. The viewer also has a manual "Refresh" button.

Log Entry Display

Each log entry shows:

  • Timestamp
  • Log level (color-coded badge)
  • Environment
  • Message
  • Full message, context and stack trace in the entry details dialog

Performance

  • Reads at most max_file_size bytes (10 MB by default) from the end of a file. An incomplete entry at the beginning of this portion is skipped.
  • A notice appears when a file is truncated. Search, filters and entry counts apply only to the loaded portion; older entries require a higher max_file_size or a smaller/rotated file.
  • Pagination limits the number of rendered rows. Parsing and searching still process the loaded portion in memory.
  • Supports Laravel/Monolog text logs, including multiline context and stack traces. JSON-formatted log files are not parsed.
  • Only readable .log and numbered rotations (.log.1, .log.2, etc.) directly inside the configured directory are shown. Paths outside it are rejected.

Development

composer install
composer test
composer format

The test suite covers file navigation, search, filters, sorting, pagination, entry details, file actions and path validation. CI runs it against Filament 4 and 5 on Laravel 12 and 13.

License

MIT License