isbkch / laravel5-tail by isbkch

A tail command for Laravel 5
1,263
1
1
Package Data
Maintainer Username: isbkch
Maintainer Contact: isbkch@gmail.com (Ilyas Bakouch)
Package Create Date: 2016-04-26
Package Last Update: 2019-04-09
Language: PHP
License: MIT
Last Refreshed: 2022-08-02 15:00:19
Package Statistics
Total Downloads: 1,263
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

A tail command for Laravel 5

This package adds the tail command to Laravel 5. This package works for daily and single logs and has support for tailing local and the remote logs.

Install

You can install the package via composer:

composer require isbkch/laravel5-tail

You must install this service provider:

// config/app.php

'providers' => [
    ...
    Isbkch\Tail\TailServiceProvider::class,
    ...
];

If you're planning on tailing remote logs you must publish the config file with this command:

php artisan vendor:publish --provider="Isbkch\Tail\TailServiceProvider"

A file named tail.php will be created in the config directory. The options you can set in the file should be self-explanatory. PS: You can get the username from the .env file


return [


    'connections' => [

        /*
         * The environment name. You can use this value in the tail command.
         */
        'production' => [

             // Hostname of the server where the logs are located
            'host' => '',


             // Username to be used when connecting to the server where the logs are located
            'user'  => env('TAIL_USERNAME', 'isbkch'),

             // Full path to the directory where the logs are located
            'logDirectory' => '',
        ],

        // Change it to 'true' if you have grc (Generic Colouriser) installed in your system
        // To install grc on Debian based: sudo apt-get install grc
        'grc' => 'false'
    ],
];

Usage

To tail the local log you can use this command:

php artisan tail

By default the last 20 lines will be shown. You can change that number by using the lines-option.

php artisan tail --lines=50

To tail a remote log you must first specify hostname and logDirectory in the config-file. After you've done that you can tail the remote logs by specify the environment as an argument.

php artisan tail production

Credits

License

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