View Laravel File-Based Logs In Web

Overview

Banner

View Laravel/Lumen logs in browser.

Packagist License Packagist Version GitHub repo size Packagist Downloads

Disclaimer

This package is simply a lightweight web interface for Laravel and Lumen file-based logs. If you need an advanced debugging tool consider trying Telescope, Debugbar, Clockwork or Ray And if you need an error tracking software consider tring Sentry and Bugsnag.

Live Preview

Visit Here to preview online playground.

Screen Shot

screen shot

Installation

You can install the package via composer:

composer require mojtabaahn/laravel-web-logs

And it's done. You can optionally publish the config file with:

php artisan vendor:publish --provider="Mojtabaahn\LaravelWebLogs\Providers\LaravelWebLogsServiceProvider" --tag="config"

This is the contents of the published config file:

use Mojtabaahn\LaravelWebLogs\Http\Middlewares\Authorize;

return [

    /*
    |--------------------------------------------------------------------------
    | Dashboard Enabled
    |--------------------------------------------------------------------------
    |
    | Here you may specify either dashboard is enabled or not
    |
    */

    'enabled' => env('WEB_LOGS_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | Route Group Attributes
    |--------------------------------------------------------------------------
    |
    | This is the array configuring package route attributes. feel free
    | to edit route prefixes, middlewares and anything else.
    |
    | In case you want to add authorization using default auth driver,
    | uncomment web middleware.
    |
    */

    'route_group_attributes' => [
        'prefix' => env('WEB_LOGS_PATH', 'web-logs'),
        'middleware' => [
            // 'web',
            Authorize::class,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Lines Per Page
    |--------------------------------------------------------------------------
    |
    | On each request from dashboard to it's back-end how many lines should
    | it read of specified log file. Setting this option to a big number
    | may reduce dashboard performance!
    |
    */

    'lines_per_page' => env('WEB_LOGS_LINES_PER_PAGE', 1000),
];

Authorization

Web Logs is enabled by default for all users and guests. In case you want to authorize users before accessing it you must register a viewWebLogs ability. A good place to do this is in the AuthServiceProvider that ships with Laravel.

public function boot()
{
    $this->registerPolicies();

    Gate::define('viewWebLogs', function ($user = null) {
        // return true if access to web logs is allowed
    });
}

Future Plans

  • Add option to auto-append new logs (like tail -f)
  • Lazy-load/Infinite-scroll for big files
  • Add guard for accessing routes
  • Move stores to Pinia
  • Add tests
  • Support nested logs (logs in subdirectories)
  • Add Day.js and time-zone support
  • Add global search option using grep or other fast search methods

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Assets not loading on production

    Assets not loading on production

    Hi there, great package!

    It works very well on development but I'm having issues with it on a production environment.

    When I visit site.com/web-logs, I see a blank page with these errors:

    Screenshot 2021-05-31 at 22 47 31

    The interesting thing is that if I open these assets files in a new tab, they load correctly. For some reasons they are not loaded from the main route /web-logs.

    Any ideas?

    opened by adddz 10
  • Remove hardcoded Gate::define()

    Remove hardcoded Gate::define()

    Can we have the hardcoded Gate::define() removed from the package Service Provider and instead allow the user to define the gate within their AuthServiceProvider? Allows for more flexibility for limiting access to the interface.

    bug documentation 
    opened by dannydinges 6
  • Cannot install

    Cannot install

    Hello,

    I try to install this package using my docker setup, but unfortunately I failed

    $  project [logs] docker-compose run --rm php composer require mojtabaahn/laravel-web-logs
    Creating project_composer_run ... done
    Using version ^1.3 for mojtabaahn/laravel-web-logs
    ./composer.json has been updated
    Running composer update mojtabaahn/laravel-web-logs
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 1 install, 0 updates, 0 removals
      - Locking mojtabaahn/laravel-web-logs (1.3.1)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover --ansi
    
    In Router.php line 375:
    
      Argument 1 passed to Illuminate\Routing\Router::group() must be of the type
       array, null given, called in /var/www/app/vendor/mojtabaahn/laravel-web-lo
      gs/src/Providers/LaravelWebLogsServiceProvider.php on line 36
    
    
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    

    I use composer 2 with PHP 7.4

    $  project [logs] docker-compose run --rm php composer -V -vvv
    Creating project_composer_run ... done
    Reading ./composer.json
    Loading config file ./composer.json
    Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
    Executing command (/var/www/app): git branch -a --no-color --no-abbrev -v
    Executing command (/var/www/app): git describe --exact-match --tags
    Executing command (CWD): git --version
    Executing command (/var/www/app): git log --pretty="%H" -n1 HEAD
    Executing command (/var/www/app): hg branch
    Executing command (/var/www/app): fossil branch list
    Executing command (/var/www/app): fossil tag list
    Executing command (/var/www/app): svn info --xml
    Failed to initialize global composer: Composer could not find the config file: /tmp/composer/composer.json
    To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
    Reading /var/www/app/vendor/composer/installed.json
    Running 2.0.7 (2020-11-13 17:31:06) with PHP 7.4.16 on Linux / 4.19.0-16-amd64
    Composer version 2.0.7 2020-11-13 17:31:06
    

    What did I miss ?

    opened by loranger 3
  • Argument #1 ($attributes) must be of type array, null given

    Argument #1 ($attributes) must be of type array, null given

    I got this error when I tried to install on a docker container, laravel 8.0 and PHP 8.0.6.

    Using version ^1.1 for mojtabaahn/laravel-web-logs
    ./composer.json has been updated
    Running composer update mojtabaahn/laravel-web-logs
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 1 install, 0 updates, 0 removals
      - Locking mojtabaahn/laravel-web-logs (1.1.0)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
      - Downloading mojtabaahn/laravel-web-logs (1.1.0)
      - Installing mojtabaahn/laravel-web-logs (1.1.0): Extracting archive
    Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover --ansi
    
    In Router.php line 375:
                                                                                                                                                                                                                              
      Illuminate\Routing\Router::group(): Argument #1 ($attributes) must be of type array, null given, called in /var/www/html/vendor/mojtabaahn/laravel-web-logs/src/Providers/LaravelWebLogsServiceProvider.php on line 36  
                                                                                                                                                                                                                              
    
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    
    opened by kostaspapad 3
  • Installation failed, unexpected '$fileInfo' in IndexLogsController

    Installation failed, unexpected '$fileInfo' in IndexLogsController

      - Installing mojtabaahn/laravel-web-logs (1.0.1): Extracting archive
    Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
    Generating optimized autoload files
    composer/package-versions-deprecated: Generating version class...
    composer/package-versions-deprecated: ...done generating version class
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover --ansi
    
    In IndexLogsController.php line 12:
    
      syntax error, unexpected '$fileInfo' (T_VARIABLE), expecting ')'
    
    
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    
    opened by iKlsR 1
  • Click filename to open in PhpStorm

    Click filename to open in PhpStorm

    Hi.

    In stead of transforming file paths into spans, this changes them into links that open the file in PhpStorm on the approprate line. It's just a proof of concept that I wanted to try.

    opened by mortenscheel 2
Releases(1.4.0)
Owner
mojtabaa hn
Web Dev & More
mojtabaa hn
Viewer de l'émission avec les logs.

Underscore_ Logs Viewer Un petit site pour voir les logs d'Underscore_. Vue 3 + Typescript + Vite This template should help get you started developing

Micode 16 May 4, 2022
Viewer de l'émission avec les logs.

Underscore_ Logs Viewer Un petit site pour voir les logs d'Underscore_. Vue 3 + Typescript + Vite This template should help get you started developing

Micode 16 May 4, 2022
Nova File Manager - A handy Laravel Nova tool for all your file management needs, with multi-disk and chunk uploads supports

A file manager tool and field for Laravel Nova. Beautifully designed, and customizable, this tool will provide a plug'n'play solution for your file management needs.

BBS 74 Dec 22, 2022
Laravel Vue SPA, Bulma themed. For demo login use `[email protected]` & `password` -

Laravel Enso Hit the ground running when building your new Laravel SPA project with boilerplate and extra functionality out of the box! click on the p

Laravel Enso 1k Jan 3, 2023
Laravel-weather-app - Laravel Weather App Built With Vue.js

Laravel Weather App Installation Clone the repo locally: git clone https://githu

Prodromos Pantos 0 Jan 14, 2022
Vuelar (Vue-Laravel) - A Laravel-powered pagination package for Vuejs

vuelar (Vue-Laravel) is a vue package that takes care of pagination for a Laravel-powered backend on a Single-Page Application. This package assumes familiarity with Laravel and requires vue-router for navigation.

SirMekus 10 Jul 31, 2022
File manager for Laravel

Laravel File Manager DEMO: Laravel File Manager Vue.js Frontend: alexusmai/vue-laravel-file-manager Documentation Laravel File Manager Docs Installati

Aleksandr Manekin 937 Jan 1, 2023
Nova Kontainer - A Laravel Nove component that adds a file picker for Kontainer

Nova Kontainer Nova Kontainer is a Laravel Nove component that adds a file picker for Kontainer Features Select any image or video from Kontainer and

Jess Stopa 1 Feb 8, 2022
Browsilo - A simple HTML file browser. One file. Made with Vue.js. Great for simple projects.

Browsilo - A simple HTML file browser. One file. Made with Vue.js. Great for simple projects.

Jacopo Valanzano 7 May 12, 2022
A web application to view npm package files

npmview A web application to view npm package files. | https://npmview.vercel.app Self-hosting for private NPM Use VITE_UNPKG_URL env to customize API

Rongjian Zhang 118 Dec 22, 2022
Stable UI is a web user interface designed to generate, save, and view images using Stable Diffusion, with the goal being able to provide Stable Diffusion to anyone.

stable-ui Stable UI is a web user interface designed to generate, save, and view images using Stable Diffusion, with the goal being able to provide St

null 52 Jan 2, 2023
A Web Application built on Laravel + Vue. Based on the Pokemon API

A Web Application built on Laravel + Vue. Based on the Pokemon API

Ryan Arcel Galendez 10 Jun 14, 2022
CMS web page for the creation of small e-commerce developed with Laravel and Vue+Vuex

Delivery Service Descrizione il servizio deve permettere con facilita' la possibilita' per un utente di trovare i ristoranti/negozi/bar che fanno atti

null 0 Nov 28, 2021
A Twitter-like, 9GAG-like web app made in Laravel 9, Vue3, InertiaJS & Tailwind

Nothing special, just a birb-gag To learn, to enjoy coding. A Twitter-like, 9GAG-ish web app where users can post text, image & video posts in categor

@stux 9 Oct 12, 2022
Open source Web File Manager (Javascript + VueJS 2)

Media Manager Media Manager is an open source web file manager and can be a nice alternative to Wordpress Media Manager, CKFinder, KCFinder, elFinder.

IUT de Bayonne et du Pays Basque 243 Dec 1, 2022
JSON Schema Editor is an intuitive editor for JSON schema. It provides a tree view to present the structure of schema, and a property inspector to edit the properties of schema element. Develop with Vue.js 2 and Firebase.

json-schema-editor An intuitive editor for JSON schema which provides a tree view to present structure of schema and a property inspector to edit the

TangramJs 235 Jan 3, 2023
Crypto News allows you to convert cryptocurrencies, view latest news and exchange rates for each ICO – all the data from the world of cryptocurrencies in one place.

Crypto News Crypto News allows you to convert cryptocurrencies, view latest news and exchange rates for each ICO – all the data from the world of cryp

Bartosz Łaniewski 26 May 12, 2022