hhxsv5/laravel-kafka-logger

The Kafka logger for Laravel.

v2.0.1 2020-07-12 14:33 UTC

This package is auto-updated.

Last update: 2021-10-15 11:42:32 UTC


README

The Kafka logger for Laravel.

Latest Version PHP Version Total Downloads License

Requirements

Dependency Requirement
php-rdkafka >=4.0.0

Install

1.Install rdkafka.

git clone --depth 1 https://github.com/edenhill/librdkafka.git /tmp/librdkafka && cd /tmp/librdkafka && ./configure && make -j$(nproc) && make install && rm -rf /tmp/librdkafka
pecl install rdkafka

2.Install laravel-kafka-logger.

# Laravel 5.x
composer require "hhxsv5/laravel-kafka-logger:~1.0.0"
# Laravel 6.x & 7.x
composer require "hhxsv5/laravel-kafka-logger:~2.0.0"

Get Started

1.Modify config/logging.php.

return [
    'channels' => [
        // ...
        'kafka' => Hhxsv5\LKL\KafkaLogger::getDefinition(['topic' => env('LOG_KAFKA_TOPIC', 'laravel-logs')]),
    ],
];

2.Modify .env.

LOG_CHANNEL=kafka
LOG_KAFKA_BROKER_LIST=kafka:9092
LOG_KAFKA_TOPIC=laravel-logs

License

MIT