Skip to content

litermi/elasticlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Litermi Logger TCP or UDP

A package to send logs to a server via udp or tcp.

It uses the new Laravel custom log channel introduced in Laravel 5.6.

Table of contents

Installation

Install via composer

composer require litermi/elasticlog:dev-master

add row in config/app.php

 \Litermi\Elasticlog\ElasticServiceProvider::class

publish config

php artisan vendor:publish --provider="Litermi\Elasticlog\Providers\ElasticServiceProvider"

Edit config/logging.php to add the new logger logs channel.

return [
        'tcp-logger'   => [
            'name'   => 'elastic',
            'driver' => 'custom',
            'via'    => \Litermi\Elasticlog\Services\Logs\SendLogTcpMonolog::class,
        ],
        'udp-logger'     => [
            'driver'  => 'monolog',
            'handler' => \Litermi\Elasticlog\Services\Logs\SendLogUdpJsonHandler::class,
        ],
        'stderr' => [
            'driver'    => 'monolog',
            'handler'   => \Monolog\Handler\StreamHandler::class,
            'formatter' => env('LOG_STDERR_FORMATTER'),
            'with'      => [
                'stream' => 'php://stderr',
            ],
        ],
];

Usage

Once you have modified the Laravel logging configuration, you can send log channel via tcp or udp as any Laravel log channel.

Example

LOG_CHANNEL=tcp-logger
or
LOG_CHANNEL=udp-logger

UPDATE PACKAGE IN PROJECTS

composer update "litermi/elasticlog"

License

litermi elastic is released under the MIT Licence. See the bundled LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages