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.
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',
],
],
];
Once you have modified the Laravel logging configuration, you can send log channel via tcp or udp as any Laravel log channel.
LOG_CHANNEL=tcp-logger
or
LOG_CHANNEL=udp-logger
composer update "litermi/elasticlog"
litermi elastic is released under the MIT Licence. See the bundled LICENSE file for details.