whchi / laravel-kafkalogger
This package is abandoned and no longer maintained.
The author suggests using the whchi/laravel-kafkalogger package instead.
send log direct into kafka via laravel
0.0.2
2019-11-14 06:41 UTC
Requires
- laravel/framework: ^5.6.0
- nmred/kafka-php: dev-master
This package is auto-updated.
Last update: 2021-07-15 07:05:25 UTC
README
在 Laravel 裡使用 Log Facade 的直接送到 kafka, ELK format
安裝步驟
- composer
composer require whchi/laravel-kafkalogger "0.0.1"
- publish vendor
php artisan vendor:publish --provider="Whchi\KafkaLogger\KafkaLogServiceProvider"
log settings
- in
config/logging.php
add
'channels' => [ ... 'kafka' => [ 'driver' => 'custom', 'via' => \App\Logging\KafkaHandler::class, ], ... ]
- add file
app/Logging/KafkaHandler.php
namespace App\Logging; use Monolog\Logger; class KafkaHandler { public function __invoke() { $logger = new Logger('custom'); $logger->pushHandler(resolve('KafkaLogger')); return $logger; } }
- edit
.env
LOG_CHANNEL=kafka