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: 2024-11-15 18:10:23 UTC


README

The Kafka logger for Laravel.

Latest Version PHP Version Total Downloads License

Requirements

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