PHPackages                             zimonh/log-viewer-custom-log-path - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. zimonh/log-viewer-custom-log-path

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

zimonh/log-viewer-custom-log-path
=================================

Fast and easy-to-use log viewer for your Laravel application

093PHP

Since Nov 17Pushed 3y agoCompare

[ Source](https://github.com/zimonh/log-viewer-custom-log-path)[ Packagist](https://packagist.org/packages/zimonh/log-viewer-custom-log-path)[ RSS](/packages/zimonh-log-viewer-custom-log-path/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Log Viewer Fork with one extra config param
Easy-to-use, fast, and beautiful
============================================================================

[](#log-viewer-fork-with-one-extra-config-parameasy-to-use-fast-and-beautiful)

 [Features](#features) | [Installation](#installation) | [Configuration](#configuration) | [Authorization](#authorization) | [Troubleshooting](#troubleshooting) | [Credits](#credits)

[![Packagist](https://camo.githubusercontent.com/cacf6df0a2c75b7bc658c49c5e530590deb3432a8ab7817b4d0cb4a4c5da3a96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70636f646573696f2f6c6f672d7669657765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opcodesio/log-viewer)[![Packagist](https://camo.githubusercontent.com/b2580dd6b48d76f6f2742985a6d94eecb160dc165fd3dcb63f34628d0831d3d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6f70636f646573696f2f6c6f672d7669657765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opcodesio/log-viewer)[![PHP from Packagist](https://camo.githubusercontent.com/d09d2b13123c455f2f28c29b20d90c3888ebad61d2075642fd851d5d5edbc1f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f70636f646573696f2f6c6f672d7669657765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opcodesio/log-viewer)[![Laravel Version](https://camo.githubusercontent.com/7b4299eddc4521e50a04f17add34364a7dacebb355d373826fad68ca5eaea5f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d382e782c253230392e782d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opcodesio/log-viewer)

[![log-viewer-light-dark](https://user-images.githubusercontent.com/8697942/186705175-d51db6ef-1615-4f94-aa1e-3ecbcb29ea24.png)](https://user-images.githubusercontent.com/8697942/186705175-d51db6ef-1615-4f94-aa1e-3ecbcb29ea24.png)

[OPcodes's](https://www.opcodes.io/) **Log Viewer** is a perfect companion for your [Laravel](https://laravel.com/) app.

You will no longer need to read the raw Laravel log files trying to find what you're looking for.

Log Viewer helps you quickly and clearly see individual log entries, to **search**, **filter**, and make sense of your Laravel logs **fast**. It is free and easy to install.

> 📺 **[Watch a quick 4-minute video](https://www.youtube.com/watch?v=q7SnF2vubRE)** showcasing some Log Viewer features.

### Features

[](#features)

- 📂 **View all the Laravel logs** in your `storage/logs` directory,
- 🔍 **Search** the logs,
- 🎚 **Filter** by log level (error, info, debug, etc.),
- 🔗 **Sharable links** to individual log entries,
- 🌑 **Dark mode**
- 💾 **Download &amp; delete** log files from the UI,
- ☑️ **Horizon** log support,
- and more...

Get Started
-----------

[](#get-started)

### Requirements

[](#requirements)

- **PHP 8.0+**
- **Laravel 8+**

### Installation

[](#installation)

To install the package via composer, Run:

```
composer require zimonh/log-viewer-custom-log-path
```

### Usage

[](#usage)

Once the installation is complete, you will be able to access **Log Viewer** directly in your browser.

By default, the application is available at: `{APP_URL}/log-viewer`.

(for example: `https://my-app.test/log-viewer`)

Configuration
-------------

[](#configuration)

### Config file

[](#config-file)

To publish the [config file](https://github.com/zimonh/log-viewer/blob/main/config/log-viewer.php), run:

```
php artisan vendor:publish --tag="log-viewer-config"
```

### Route &amp; Middleware

[](#route--middleware)

You can easily change the default route and its middleware in the config/log-viewer.php.

See the configuration below:

```
    /*
    |--------------------------------------------------------------------------
    | Log Viewer Domain
    |--------------------------------------------------------------------------
    | You may change the domain where Log Viewer should be active.
    | If the domain is empty, all domains will be valid.
    |
    */

    'route_domain' => null,

    /*
    |--------------------------------------------------------------------------
    | Log Viewer Route
    |--------------------------------------------------------------------------
    | Log Viewer will be available under this URL.
    |
    */

    'route_path' => 'log-viewer',

    /*
    |--------------------------------------------------------------------------
    | Log Viewer route middleware.
    |--------------------------------------------------------------------------
    | The middleware should enable session and cookies support in order for the Log Viewer to work.
    | The 'web' middleware will be applied automatically if empty.
    |
    */

    'middleware' => ['web'],
```

Authorization
-------------

[](#authorization)

Several things can be configured to have different access based on the user logged in, or the log file in action.

Here are the permissions and how to set them up.

### Authorizing Log Viewer access

[](#authorizing-log-viewer-access)

You can limit who has access to the Log Viewer in several ways.

#### Via "auth" callback

[](#via-auth-callback)

You can limit access to the Log Viewer by providing a custom authorization callback to the `LogViewer::auth()` method within your `AppServiceProvider`, like so:

```
use Zimonh\LogViewer\Facades\LogViewer;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    LogViewer::auth(function ($request) {
        // return true to allow viewing the Log Viewer.
    });

    // Here's an example:
    LogViewer::auth(function ($request) {
        return $request->user()
            && in_array($request->user()->email, [
                // 'john@example.com',
            ]);
    });
}
```

#### Via "viewLogViewer" gate

[](#via-viewlogviewer-gate)

Another easy way to limit access to the Log Viewer is via [Laravel Gates](https://laravel.com/docs/9.x/authorization#gates). Just define a `viewLogViewer` authorization gate in your `App\Providers\AuthServiceProvider` class:

```
use App\Models\User;
use Illuminate\Support\Facades\Gate;

/**
 * Register any authentication / authorization services.
 *
 * @return void
 */
public function boot()
{
    $this->registerPolicies();

    Gate::define('viewLogViewer', function (?User $user) {
        // return true if the user is allowed access to the Log Viewer
    });
}
```

#### Via middleware

[](#via-middleware)

You can easily add [authentication](https://laravel.com/docs/9.x/authentication#protecting-routes) to log viewing routes using popular `auth` middleware in the `config/log-viewer.php`.

If your application doesn't use the default authentication solutions, you can use the `auth.basic` [HTTP Basic Authentication](https://laravel.com/docs/9.x/authentication#http-basic-authentication) middleware.

***Note:** By default, the `auth.basic` middleware will assume the email column on your users database table is the user's "username".*

See the `auth` middleware configuration below:

```
    /*
    |--------------------------------------------------------------------------
    | Log Viewer route middleware.
    |--------------------------------------------------------------------------
    | The middleware should enable session and cookies support in order for the Log Viewer to work.
    | The 'web' middleware will be applied automatically if empty.
    |
    */

    'middleware' => ['web', 'auth'],
```

For authorization using Spatie permissions [see this discussion](https://github.com/opcodesio/log-viewer/discussions/16)

### Authorizing log file download

[](#authorizing-log-file-download)

You can limit the ability to download log files via [Laravel Gates](https://laravel.com/docs/9.x/authorization#gates). Just define a `downloadLogFile` authorization gate in your `App\Providers\AuthServiceProvider` class:

```
use App\Models\User;
use Zimonh\LogViewer\LogFile;
use Illuminate\Support\Facades\Gate;

/**
 * Register any authentication / authorization services.
 *
 * @return void
 */
public function boot()
{
    $this->registerPolicies();

    Gate::define('downloadLogFile', function (?User $user, LogFile $file) {
        // return true if the user is allowed to download the specific log file.
    });
}
```

#### Authorizing folder downloads

[](#authorizing-folder-downloads)

You can also limit whether whole folders can be downloaded by defining a `downloadLogFolder` authorization gate:

```
use Zimonh\LogViewer\LogFolder;

//...

Gate::define('downloadLogFolder', function (?User $user, LogFolder $folder) {
    // return true if the user is allowed to download the whole folder.
});
```

**NOTE:** Individual file permissions are also checked before downloading them, to avoid accidental downloads of protected log files.

### Authorizing log file deletion

[](#authorizing-log-file-deletion)

You can limit the ability to delete log files via [Laravel Gates](https://laravel.com/docs/9.x/authorization#gates). Just define a `deleteLogFile` authorization gate in your `App\Providers\AuthServiceProvider` class:

```
use App\Models\User;
use Zimonh\LogViewer\LogFile;
use Illuminate\Support\Facades\Gate;

/**
 * Register any authentication / authorization services.
 *
 * @return void
 */
public function boot()
{
    $this->registerPolicies();

    Gate::define('deleteLogFile', function (?User $user, LogFile $file) {
        // return true if the user is allowed to delete the specific log file.
    });
}
```

#### Authorizing folder deletion

[](#authorizing-folder-deletion)

You can also limit whether whole folders can be deleted by defining a `deleteLogFolder` authorization gate:

```
use Zimonh\LogViewer\LogFolder;

//...

Gate::define('deleteLogFolder', function (?User $user, LogFolder $folder) {
    // return true if the user is allowed to delete the whole folder.
});
```

**NOTE:** Individual file permissions are also checked before deleting them, to avoid accidental deletion of protected log files.

Troubleshooting
---------------

[](#troubleshooting)

Here are some common problems and solutions.

### Problem: "Livewire not defined" or other errors in the browser's console

[](#problem-livewire-not-defined-or-other-errors-in-the-browsers-console)

This is most often caused by your project being served from a sub-folder, like `example.com/your-laravel-project/log-viewer`.

Livewire by default tries to load its resources from the root of the domain, like `example.com/livewire/livewire.js`, but if that's outside your project's sub-folder, then you need to set a different asset\_url. You can [read more about it here](https://laravel-livewire.com/docs/2.x/installation#configuring-the-asset-base-url).

Fortunately, the fix is easy:

1. Publish the Livewire config:

```
php artisan livewire:publish --config
```

2. Set the `asset_url` option in the `config/livewire.php` file to your app's subdomain:

```
    'asset_url' => '/your-laravel-project',
```

### Problem: Logs not loading

[](#problem-logs-not-loading)

At the moment, Log Viewer is only able to process [Laravel logs](https://laravel.com/docs/9.x/logging) that look something like this:

```
[2022-08-25 11:16:17] local.DEBUG: Example log entry for the level debug {"one":1,"two":"two","three":[1,2,3]}
Multiple lines are allowed
and will be picked up as contents
of the same log entry.

```

If your logs are structured differently, then you'll have to wait until we ship support for custom log formats. Otherwise, please adjust your log format to Laravel's default.

Screenshots
-----------

[](#screenshots)

Read the **[release blog post](https://arunas.dev/log-viewer-for-laravel/)** for screenshots and more information about Log Viewer's features.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Arunas Skirius](https://github.com/arukompas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 89.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/58448077f123a750565d11597fc7a94933b8ea4b8fb984a479e288236fc0176a?d=identicon)[zimonh](/maintainers/zimonh)

---

Top Contributors

[![arukompas](https://avatars.githubusercontent.com/u/8697942?v=4)](https://github.com/arukompas "arukompas (316 commits)")[![Kamandlou](https://avatars.githubusercontent.com/u/77993374?v=4)](https://github.com/Kamandlou "Kamandlou (9 commits)")[![dansysanalyst](https://avatars.githubusercontent.com/u/79267265?v=4)](https://github.com/dansysanalyst "dansysanalyst (6 commits)")[![zimonh](https://avatars.githubusercontent.com/u/4648145?v=4)](https://github.com/zimonh "zimonh (6 commits)")[![Advaith3600](https://avatars.githubusercontent.com/u/21041099?v=4)](https://github.com/Advaith3600 "Advaith3600 (5 commits)")[![CrazyBoy49z](https://avatars.githubusercontent.com/u/3448603?v=4)](https://github.com/CrazyBoy49z "CrazyBoy49z (2 commits)")[![JemCdo](https://avatars.githubusercontent.com/u/40404495?v=4)](https://github.com/JemCdo "JemCdo (2 commits)")[![alphaolomi](https://avatars.githubusercontent.com/u/10551599?v=4)](https://github.com/alphaolomi "alphaolomi (2 commits)")[![fsamapoor](https://avatars.githubusercontent.com/u/4992968?v=4)](https://github.com/fsamapoor "fsamapoor (1 commits)")[![memu](https://avatars.githubusercontent.com/u/11529470?v=4)](https://github.com/memu "memu (1 commits)")[![tfevens](https://avatars.githubusercontent.com/u/701763?v=4)](https://github.com/tfevens "tfevens (1 commits)")[![jnyheim](https://avatars.githubusercontent.com/u/41641315?v=4)](https://github.com/jnyheim "jnyheim (1 commits)")

### Embed Badge

![Health badge](/badges/zimonh-log-viewer-custom-log-path/health.svg)

```
[![Health](https://phpackages.com/badges/zimonh-log-viewer-custom-log-path/health.svg)](https://phpackages.com/packages/zimonh-log-viewer-custom-log-path)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
