litermi / elasticlog
A simple hello world composer package
Installs: 3 542
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
This package is auto-updated.
Last update: 2025-02-20 08:42:37 UTC
README
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.