PHPackages                             tasmidur/kafka-monolog-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. tasmidur/kafka-monolog-handler

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

tasmidur/kafka-monolog-handler
==============================

Kafka Monolog Handler is used for pushing laravel log into the Kafka message broker

v1.1.1(3y ago)62.6k↓50%[1 issues](https://github.com/tasmidur/kafka-monolog-handler/issues)MITPHPPHP ^8.0

Since Sep 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/tasmidur/kafka-monolog-handler)[ Packagist](https://packagist.org/packages/tasmidur/kafka-monolog-handler)[ Docs](https://github.com/tasmidur/kafka-monolog-handler)[ RSS](/packages/tasmidur-kafka-monolog-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (4)Used By (0)

Kafka Monolog Handler
=====================

[](#kafka-monolog-handler)

The "kafka-monolog-handler" package is a package for Laravel framework. This package allows you to send your Laravel application's log messages to a Kafka server using Monolog, a popular logging library for PHP.

The package provides a handler for Monolog that sends log messages to a Kafka topic. The package also includes a config file, where you can specify the host and port of your Kafka server, as well as the topic to which the log messages should be sent

Requirements
------------

[](#requirements)

DependencyRequirement[php](https://github.com/arnaud-lb/php-rdkafka)`>=8.0`[Laravel](https://github.com/arnaud-lb/php-rdkafka)`>=8.0`This package also requires the rdkafka php extension, which you can install by following [this documentation](https://github.com/edenhill/librdkafka#installation)

Install
-------

[](#install)

Install [kafka-monolog-handler](https://packagist.org/packages/tasmidur/kafka-monolog-handler).

```
composer require tasmidur/kafka-monolog-handler
```

Get Started
-----------

[](#get-started)

1.Modify `config/logging.php`.

### Without Kafka SASL Config

[](#without-kafka-sasl-config)

```
return [
    'channels' => [
        // ...
       'kafka' => \Tasmidur\KafkaMonologHandler\KafkaLogger::getInstance(
            topicName: env('KAFKA_LOG_FILE_TOPIC', 'laravel_logs'),
            brokers: env('KAFKA_LOG_BROKERS')
        ),
    ],
];
```

### With Kafka SASL Config and Log Formatter like ElasticsearchFormatter

[](#with-kafka-sasl-config-and-log-formatter-like-elasticsearchformatter)

```
return [
    'channels' => [
        // ...
       'kafka' => \Tasmidur\KafkaLogger\KafkaLogger::getInstance(
            topicName: env('KAFKA_LOG_FILE_TOPIC', 'system_logs'),
            brokers: env('KAFKA_BROKERS'),
            options: [
                'is_sasl_apply' => env('IS_SASL_APPLY'), //true = applied or false= not apply
                'sasl_config' => [
                    'username' => env('KAFKA_BROKER_USERNAME'),
                    'password' => env('KAFKA_BROKER_PASSWORD'),
                    'mechanisms' => env('KAFKA_BROKER_MECHANISMS'),
                    'security_protocol' => env('KAFKA_BROKER_SECURITY_PROTOCOL')
                ],
                'formatter' => new ElasticsearchFormatter(
                    index: env('KAFKA_LOG_FILE_TOPIC', 'laravel_logs'),
                    type: "_doc")
            ]
        ),
    ],
];
```

2.Modify `.env`.

```
LOG_CHANNEL=kafka
KAFKA_BROKERS=kafka:9092,kafka:9093
KAFKA_LOG_FILE_TOPIC=laravel-logs

IS_SASL_APPLY=false
KAFKA_BROKER_USERNAME=username
KAFKA_BROKER_PASSWORD=password
KAFKA_BROKER_MECHANISMS=SCRAM-SHA-512
KAFKA_BROKER_SECURITY_PROTOCOL=SASL_SSL

```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

3

Last Release

1346d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9116ab1c020eb91ff525ad84e61a644a88416f2b6a17196e21fa1369293272c3?d=identicon)[tasmidur](/maintainers/tasmidur)

---

Top Contributors

[![piyal-ict-mbstu](https://avatars.githubusercontent.com/u/30130475?v=4)](https://github.com/piyal-ict-mbstu "piyal-ict-mbstu (12 commits)")[![tasmidur](https://avatars.githubusercontent.com/u/18406635?v=4)](https://github.com/tasmidur "tasmidur (7 commits)")

---

Tags

kafkakafka-producerlaravelmonolog-handlerlaravellumenloggerkafkaLaravel logmessage-brokerbrokerkafka broker

### Embed Badge

![Health badge](/badges/tasmidur-kafka-monolog-handler/health.svg)

```
[![Health](https://phpackages.com/badges/tasmidur-kafka-monolog-handler/health.svg)](https://phpackages.com/packages/tasmidur-kafka-monolog-handler)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[marvinlabs/laravel-discord-logger

Logging to a discord channel in Laravel

2081.1M2](/packages/marvinlabs-laravel-discord-logger)[ytake/laravel-aspect

Aspect Oriented Programming library for laravel framework, and lumen

138132.2k1](/packages/ytake-laravel-aspect)[ytake/laravel-fluent-logger

fluent logger for laravel and lumen

63541.6k1](/packages/ytake-laravel-fluent-logger)[hhxsv5/laravel-kafka-logger

The Kafka logger for Laravel.

1014.3k](/packages/hhxsv5-laravel-kafka-logger)[melihovv/laravel-log-viewer

A Laravel log viewer

1231.5k1](/packages/melihovv-laravel-log-viewer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
