Documentation

Complete guide to installing, configuring, and using Laravel Log Tracker

Introduction

Loading...

Laravel Log Tracker is a powerful package for tracking, analyzing, and managing your Laravel application logs effortlessly. It includes global multi-file search, side-by-side log comparison, smart alerts (Mail, Slack, Discord, Webhook), row bookmarks, frequent entries panel, copy to clipboard, and major performance improvements — all with zero external dependencies.

✔ Key Features: Interactive Dashboard • Global Multi-File Search • Log Comparison • Smart Alerts (4 channels) • Dual Themes • Zero-Dependency Exports • Row Bookmarks • Frequent Entries Panel • Copy to Clipboard • Error Pattern Analysis • Real-time Statistics

Why Use Laravel Log Tracker?

System Requirements

Laravel Version PHP Version Status
12.x 8.1, 8.2, 8.3, 8.4 ✅ Fully Tested
11.x 8.1, 8.2, 8.3 ✅ Fully Tested
10.x 8.0, 8.1, 8.2 ✅ Fully Tested

Server Requirements

PHP Extensions
JSON & MBString extensions must be enabled
Storage Permissions
Laravel storage/ directory must be writable
Memory Limit
Minimum 128MB PHP memory limit recommended

Installation

Step 1: Install via Composer

Terminal
composer require kssadi/log-tracker

Step 2: Publish Configuration (Optional)

Terminal
php artisan vendor:publish --provider="Kssadi\LogTracker\LogTrackerServiceProvider" --tag="config"

This publishes the configuration file to config/log-tracker.php

✅ Installation Complete! You can now access the dashboard at /log-tracker

Quick Start

Access the Dashboard

Navigate to your application's log tracker dashboard:

URL
https://your-domain.com/log-tracker
⚠️ Authentication Required: By default, the dashboard is protected by web and auth middleware. Users must be logged in to access it.

Basic Usage Flow

  1. Dashboard Overview: View log statistics, error patterns, and peak error hours
  2. Browse Log Files: Click on any log file to view its contents
  3. Filter Logs: Use filters to narrow down by level, date, or keywords
  4. Export Data: Export filtered logs in CSV, Excel, PDF, or JSON format
  5. Manage Files: Download or delete log files as needed

Configuration

The configuration file is located at config/log-tracker.php. Here's the complete structure:

config/log-tracker.php
<?php

return [
    // Route configuration
    'route' => [
        'enabled' => true,
        'prefix' => 'log-tracker',
        'middleware' => ['web', 'auth'],
    ],

    // Theme selection: 'GlowStack' or 'LiteFlow'
    'theme' => env('LOG_TRACKER_THEME', 'GlowStack'),

    // Log levels with colors and icons
    'levels' => [
        'emergency' => ['color' => '#dc2626', 'icon' => '🚨'],
        'alert' => ['color' => '#ea580c', 'icon' => '🔔'],
        'critical' => ['color' => '#f59e0b', 'icon' => '⚠️'],
        'error' => ['color' => '#ef4444', 'icon' => '❌'],
        'warning' => ['color' => '#eab308', 'icon' => '⚠️'],
        'notice' => ['color' => '#3b82f6', 'icon' => 'ℹ️'],
        'info' => ['color' => '#06b6d4', 'icon' => '📋'],
        'debug' => ['color' => '#8b5cf6', 'icon' => '🐞'],
    ],

    // Pagination settings
    'pagination' => [
        'per_page' => 50,
        'max_per_page' => 200,
        'file_list_per_page' => 20,
    ],

    // File handling
    'files' => [
        'max_file_size_mb' => 10,
        'allowed_extensions' => ['log'],
        'exclude_patterns' => [],
    ],

    // Export configuration
    'export' => [
        'enabled' => true,
        'formats' => [
            'csv' => ['enabled' => true],
            'json' => ['enabled' => true],
            'excel' => ['enabled' => true],
            'pdf' => ['enabled' => true],
        ],
        'limits' => [
            'max_entries' => 50000,
            'max_file_size_mb' => 50,
            'timeout_seconds' => 300,
        ],
        'storage' => [
            'cleanup_after_days' => 7,
        ],
    ],

    // Cache settings
    'cache' => [
        'enabled' => true,
        'ttl' => 300, // 5 minutes
    ],
];

Log Levels Configuration

Customize the appearance of different log levels:

Level Default Color Default Icon Description
emergency #dc2626 🚨 System is unusable
alert #ea580c 🔔 Action must be taken immediately
critical #f59e0b ⚠️ Critical conditions
error #ef4444 Runtime errors
warning #eab308 ⚠️ Warning messages
notice #3b82f6 ℹ️ Normal but significant
info #06b6d4 📋 Informational messages
debug #8b5cf6 🐞 Debug information

Pagination Settings

'pagination' => [
    'per_page' => 50,           // Entries per page
    'max_per_page' => 200,      // Maximum allowed per page
    'file_list_per_page' => 20, // Files per page in file list
],

Adjust these values based on your server's performance and user preferences.

File Size Limits

'files' => [
    'max_file_size_mb' => 10,      // Max file size to process
    'allowed_extensions' => ['log'], // Allowed file extensions
    'exclude_patterns' => [],       // Files to exclude (regex)
],
⚠️ Performance Note: Large log files (>10MB) may cause memory issues. The package will skip files exceeding the limit.

Dashboard Access

Default Route

Access the dashboard at:

https://your-domain.com/log-tracker

Custom Route Prefix

Change the route prefix in your configuration:

'route' => [
    'prefix' => 'admin/logs', // Custom prefix
    'middleware' => ['web', 'auth'],
],

Dashboard will now be accessible at: /admin/logs

Dashboard Features

Filtering Logs

Filter by Log Level

Use the level dropdown to show only specific log levels:

Filter by Date Range

Select start and end dates to view logs from specific time periods.

Search by Keyword

Use the search box to find logs containing specific text, error messages, or stack traces.

💡 Pro Tip: Combine multiple filters for precise log analysis. For example, filter by "error" level + specific date range + keyword search.

Log File Management

Viewing Log Files

  1. Navigate to the log files list page
  2. Click on any log file name to view its contents
  3. Use pagination to browse through entries

Downloading Log Files

Click the download button next to any log file to download it to your local system.

Deleting Log Files

Click the delete button to remove log files. A confirmation dialog will appear.

⚠️ Warning: Deleting log files is permanent and cannot be undone. Make sure to backup important logs before deletion.

Searching Logs (In-File)

Full-Text Search

Use the search box on any log file view page to filter entries within that file. The search looks for matches in:

Search Tips

🔍 Need to search across all files? Use the Global Multi-File Search feature available at /log-tracker/search.

Log File Comparison

The comparison tool lets you place two log files side-by-side to identify differences, track regressions, or understand what changed between deployments.

Accessing the Comparison

https://your-domain.com/log-tracker/compare

Usage

  1. Select File A from the first dropdown
  2. Select File B from the second dropdown
  3. Click Compare — entries unique to each file are highlighted in the side-by-side view

Comparison Columns

ColumnDescription
Only in File AEntries present in the left file but absent in the right
CommonEntries that appear in both files
Only in File BEntries present in the right file but absent in the left

Alerts & Notifications

Laravel Log Tracker can send real-time alerts when new error entries are detected. Four channels are supported out of the box, all configurable in config/log-tracker.php.

Supported Channels

ChannelConfig KeyRequirements
Mailalerts.channels.mailLaravel mail configured (MAIL_* env vars)
Slackalerts.channels.slackSlack Incoming Webhook URL
Discordalerts.channels.discordDiscord Webhook URL
Webhookalerts.channels.webhookAny HTTP endpoint accepting POST JSON

Full Configuration

'alerts' => [
    'enabled' => true,
    'levels'  => ['emergency', 'alert', 'critical', 'error'],
    'cooldown_minutes' => 30,

    'channels' => [
        'mail' => [
            'enabled' => true,
            'to'      => 'admin@example.com',
        ],
        'slack' => [
            'enabled'     => false,
            'webhook_url' => env('LOG_TRACKER_SLACK_WEBHOOK'),
        ],
        'discord' => [
            'enabled'     => false,
            'webhook_url' => env('LOG_TRACKER_DISCORD_WEBHOOK'),
        ],
        'webhook' => [
            'enabled' => false,
            'url'     => env('LOG_TRACKER_WEBHOOK_URL'),
        ],
    ],
],
⚠ Cooldown: Alerts respect the cooldown_minutes setting to prevent notification fatigue. The same log file won't trigger another alert until the cooldown expires.

📧 Channel 1 — Mail

Mail uses your existing Laravel mailer — no extra packages required.

Step 1: Make sure your .env has a working mail driver configured:

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@yourdomain.com
MAIL_FROM_NAME="Laravel Log Tracker"

Step 2: Enable mail alerts in config/log-tracker.php:

'mail' => [
    'enabled' => true,
    'to'      => 'admin@yourdomain.com', // recipient address
],
💡 Tip: You can use any supported Laravel mail driver — SMTP, Mailgun, SES, Postmark, Sendmail, or log (for local testing). The log driver writes emails to storage/logs/laravel.log so you can verify alerts work without a real mail server.

💬 Channel 2 — Slack

Step 1: Create a Slack Incoming Webhook

  1. Go to api.slack.com/apps and click Create New AppFrom scratch.
  2. Give it a name (e.g. Log Tracker Alerts) and select your workspace.
  3. In the left sidebar, go to Incoming Webhooks and toggle it On.
  4. Click Add New Webhook to Workspace, pick a channel (e.g. #alerts), and authorize.
  5. Copy the generated Webhook URL — it looks like:
    https://hooks.slack.com/services/T00/B0000/XXXXXXX

Step 2: Add the webhook URL to your .env:

LOG_TRACKER_SLACK_WEBHOOK=https://hooks.slack.com/services/T00/B0000/XXXXXXX

Step 3: Enable Slack in config/log-tracker.php:

'slack' => [
    'enabled'     => true,
    'webhook_url' => env('LOG_TRACKER_SLACK_WEBHOOK'),
],

🎮 Channel 3 — Discord

Step 1: Create a Discord Webhook

  1. Open your Discord server and go to the channel you want to receive alerts in.
  2. Click the Edit Channel (⚙) gear icon next to the channel name.
  3. Navigate to IntegrationsWebhooksNew Webhook.
  4. Give it a name and optionally upload an avatar, then click Copy Webhook URL.
    It looks like: https://discord.com/api/webhooks/1234567890/XXXXXXXX

Step 2: Add the webhook URL to your .env:

LOG_TRACKER_DISCORD_WEBHOOK=https://discord.com/api/webhooks/1234567890/XXXXXXXXXXXXXXXX

Step 3: Enable Discord in config/log-tracker.php:

'discord' => [
    'enabled'     => true,
    'webhook_url' => env('LOG_TRACKER_DISCORD_WEBHOOK'),
],

🔗 Channel 4 — Custom Webhook

Send alert payloads to any HTTP endpoint — useful for integrating with PagerDuty, custom dashboards, n8n, Zapier, or your own API.

Step 1: Add your endpoint URL to .env:

LOG_TRACKER_WEBHOOK_URL=https://your-app.com/api/log-alerts

Step 2: Enable the webhook channel in config/log-tracker.php:

'webhook' => [
    'enabled' => true,
    'url'     => env('LOG_TRACKER_WEBHOOK_URL'),
],

Payload format — your endpoint will receive a POST request with a JSON body like this:

{
    "level": "error",
    "message": "Uncaught Exception: ...",
    "file": "laravel-2026-02-24.log",
    "occurred_at": "2026-02-24T10:35:00Z",
    "app_url": "https://your-domain.com"
}
💡 Tip: Your endpoint should return a 2xx HTTP status code. Non-2xx responses are logged as a warning in storage/logs/laravel.log but won't crash the alert process.

🚨 Controlling Which Levels Trigger Alerts

By default, only emergency, alert, critical, and error levels trigger notifications. You can customize this list:

'levels' => ['emergency', 'alert', 'critical', 'error', 'warning'],

⏱ Running Alerts Automatically (Scheduler)

For continuous monitoring, schedule the alert check command in routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('log-tracker:check-alerts')->everyFiveMinutes();
Schedule::command('log-tracker:cleanup')->daily();

Make sure your Laravel scheduler is running. Add this cron entry to your server:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
💡 Local Testing: To test alerts without a cron job, run the scheduler worker in your terminal:
php artisan schedule:work

🧪 Manually Trigger an Alert Check

You can trigger an alert check at any time without waiting for the scheduler:

php artisan log-tracker:check-alerts
⚠ Cooldown: If an alert was already sent for a log file within the cooldown_minutes window, the check will skip it silently. Reset cooldowns by clearing the cache: php artisan cache:clear.

Copy to Clipboard & Row Bookmarks

Copy to Clipboard

Every log entry row has a Copy button that copies the full log message (and stack trace if expanded) to the clipboard in one click. Useful for pasting into Slack, bug trackers, or emails.

Row Bookmarks

Click the bookmark icon on any log row to mark it with a gold highlight. Bookmarks are stored in localStorage and persist across page reloads and browser sessions for the same log file.

Frequent Entries Panel

When viewing a log file, the Frequent Entries panel automatically surfaces the top 15 most repeated log messages so you can immediately identify persistent issues without scrolling through thousands of lines.

Panel Columns

ColumnDescription
MessageThe repeated log message (first 120 chars)
CountHow many times this exact message appeared
First SeenTimestamp of the first occurrence in this file
Last SeenTimestamp of the most recent occurrence
💡 Tip: Frequent Entries are calculated from the pre-parsed entry list — there is no second file read, so performance impact is minimal even for large files.

Artisan Commands

CommandDescription
log-tracker:theme set {theme} Switch the active theme (GlowStack or LiteFlow) by updating the config/env
log-tracker:theme current Display the currently active theme
log-tracker:check-alerts Scan log files for new errors and dispatch alert notifications to configured channels
log-tracker:cleanup Delete exported files older than cleanup_after_days from the export storage directory

Examples

# Switch to LiteFlow theme
php artisan log-tracker:theme set LiteFlow

# Check which theme is active
php artisan log-tracker:theme current

# Manually send alerts for new errors detected since last check
php artisan log-tracker:check-alerts

# Clean up old export files
php artisan log-tracker:cleanup
🕐 Scheduled Alerts: Add log-tracker:check-alerts to your Laravel scheduler for automatic alerting:
// routes/console.php
Schedule::command('log-tracker:check-alerts')->everyFiveMinutes();
Schedule::command('log-tracker:cleanup')->daily();

Themes Overview

Laravel Log Tracker comes with two beautiful themes designed for different preferences and use cases.

✅ Dual Theme System: Switch between GlowStack (modern & colorful) and LiteFlow (minimal & clean) instantly.

GlowStack Theme

Modern, colorful, enhanced visual log view with rich colors and advanced styling.

Features

Best For

LiteFlow Theme

Minimal, clean log view with streamlined interface and excellent readability.

Features

Best For

Switching Themes

Via Artisan Command

# Switch to GlowStack theme
php artisan log-tracker:theme set GlowStack

# Switch to LiteFlow theme
php artisan log-tracker:theme set LiteFlow

# Check current theme
php artisan log-tracker:theme current

Via Configuration File

Edit config/log-tracker.php:

'theme' => env('LOG_TRACKER_THEME', 'GlowStack'), // or 'LiteFlow'

Via Environment Variable

Add to your .env file:

LOG_TRACKER_THEME=GlowStack
# or
LOG_TRACKER_THEME=LiteFlow
✅ No Cache Clear Required: Theme changes take effect immediately without clearing cache.

Export Features

Export your logs in multiple formats with absolutely zero external dependencies.

Supported Formats

Export Limits

'export' => [
    'limits' => [
        'max_entries' => 50000,      // Max log entries per export
        'max_file_size_mb' => 50,    // Max export file size
        'timeout_seconds' => 300,     // Export timeout
    ],
];

Automatic Cleanup

Exported files are automatically deleted after 7 days to save storage space:

'storage' => [
    'cleanup_after_days' => 7,
],

CSV Export

Export logs as comma-separated values, compatible with Excel, Google Sheets, and other spreadsheet applications.

CSV Structure

Timestamp,Level,Message,Context,Extra
2025-01-15 10:30:45,error,"Database connection failed","{\"host\":\"localhost\"}",""
2025-01-15 10:31:22,warning,"Slow query detected","{\"duration\":\"2.5s\"}",""

Enable/Disable

'formats' => [
    'csv' => [
        'enabled' => true,
        'description' => 'Excel-compatible CSV format'
    ],
],

Excel Export

Native Excel XML format with formatted tables and styling.

Features

Configuration

'formats' => [
    'excel' => [
        'enabled' => true,
        'description' => 'Native Excel XML format'
    ],
],

PDF Export

Print-ready HTML report converted to PDF format.

Features

Configuration

'formats' => [
    'pdf' => [
        'enabled' => true,
        'description' => 'Print-ready HTML report'
    ],
],

JSON Export

Structured JSON format with complete metadata and context.

JSON Structure

{
  "metadata": {
    "exported_at": "2025-01-15T10:30:00Z",
    "total_entries": 1523,
    "filters": {
      "level": "error",
      "date_from": "2025-01-01",
      "date_to": "2025-01-15"
    }
  },
  "logs": [
    {
      "timestamp": "2025-01-15 10:30:45",
      "level": "error",
      "message": "Database connection failed",
      "context": {
        "host": "localhost",
        "port": 3306
      },
      "extra": {}
    }
  ]
}

Configuration

'formats' => [
    'json' => [
        'enabled' => true,
        'description' => 'Structured JSON with metadata'
    ],
],

Customization

Custom Log Levels

Add or modify log levels in your configuration:

'levels' => [
    'custom' => [
        'color' => '#10b981',
        'icon' => '🏆'
    ],
    // ... other levels
],

Custom Middleware

Add your own middleware for additional security:

'route' => [
    'middleware' => ['web', 'auth', 'can:view-logs'],
],

Custom Route Prefix

'route' => [
    'prefix' => 'admin/system/logs',
],

Publish and Modify Views

php artisan vendor:publish --provider="Kssadi\LogTracker\LogTrackerServiceProvider" --tag="views"

Views will be published to resources/views/vendor/log-tracker/

Middleware Configuration

Default Middleware

By default, the dashboard is protected by:

Add Role-Based Access

// config/log-tracker.php
'route' => [
    'middleware' => ['web', 'auth', 'role:admin'],
],

Add IP Whitelist

// config/log-tracker.php
'route' => [
    'middleware' => ['web', 'auth', 'ip.whitelist'],
],

Custom Middleware

Create your own middleware for advanced access control:

php artisan make:middleware LogTrackerAccess
// app/Http/Middleware/LogTrackerAccess.php
public function handle($request, Closure $next)
{
    if (!auth()->user()->can('access-log-tracker')) {
        abort(403, 'Unauthorized access to Log Tracker');
    }
    
    return $next($request);
}
// config/log-tracker.php
'route' => [
    'middleware' => ['web', 'auth', LogTrackerAccess::class],
],

Troubleshooting

Dashboard Shows 404 Error

Solution: Clear route cache and recheck configuration:

php artisan route:clear
php artisan config:clear

Large Files Not Loading

Solution: Adjust the max file size limit:

'files' => [
    'max_file_size_mb' => 20, // Increase limit
],

Memory Limit Errors

Solution: Increase PHP memory limit in php.ini:

memory_limit = 256M

Export Timeout

Solution: Increase export timeout:

'export' => [
    'limits' => [
        'timeout_seconds' => 600, // 10 minutes
    ],
],

Theme Not Changing

Solution: Clear config cache:

php artisan config:clear
php artisan cache:clear

Permission Denied Errors

Solution: Ensure storage directory has write permissions:

chmod -R 775 storage/logs
chown -R www-data:www-data storage/logs

Frequently Asked Questions

Is Laravel Log Tracker free?

Yes! Laravel Log Tracker is completely free and open-source under the MIT license.

Does it work with custom log channels?

Yes, it works with all Laravel log channels including custom channels.

Can I use it in production?

Absolutely! The package includes security features, middleware protection, and performance optimizations for production use.

Does it require external dependencies for exports?

No! All 4 export formats (CSV, Excel, PDF, JSON) work with zero external dependencies.

Can I customize the interface?

Yes, you can publish views and modify them to match your design:

php artisan vendor:publish --provider="Kssadi\LogTracker\LogTrackerServiceProvider" --tag="views"

How do I update to the latest version?

composer update kssadi/log-tracker

Where can I report bugs or request features?

Visit the GitHub Issues page.

How can I support the project?

Star on GitHub

Show your support

Buy Me a Coffee

Support development

📢

Share the Project

Spread the word

🐛

Contribute

Report issues & ideas