Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
piyal-ict-mbstu committed Sep 11, 2022
2 parents be421a4 + 10d6471 commit 121befa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This package also requires the rdkafka php extension, which you can install by f

## Install

Install `kafka-monolog-handler`.
Install [kafka-monolog-handler](https://packagist.org/packages/tasmidur/kafka-monolog-handler).
```shell
composer require tasmidur/kafka-monolog-handler
```
Expand All @@ -27,14 +27,14 @@ composer require tasmidur/kafka-monolog-handler
return [
'channels' => [
// ...
'kafka' => \Tasmidur\KafkaLogger\KafkaLogger::getInstance(
topicName: env('KAFKA_LOG_FILE_TOPIC', 'system_logs'),
brokers: env('KAFKA_BROKERS')
'kafka' => \Tasmidur\KafkaMonologHandler\KafkaLogger::getInstance(
topicName: env('KAFKA_LOG_FILE_TOPIC', 'laravel_logs'),
brokers: env('KAFKA_LOG_BROKERS')
),
],
];
```
### With Kafka SASL Config
### With Kafka SASL Config and Log Formatter like ElasticsearchFormatter
```php
return [
'channels' => [
Expand All @@ -43,12 +43,16 @@ return [
topicName: env('KAFKA_LOG_FILE_TOPIC', 'system_logs'),
brokers: env('KAFKA_BROKERS'),
options: [
'is_sasl_apply' => env('IS_SASL'), //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")
]
),
],
Expand All @@ -62,8 +66,8 @@ KAFKA_LOG_FILE_TOPIC=laravel-logs
KAFKA_BROKER_USERNAME=username
KAFKA_BROKER_PASSWORD=password
KAFKA_BROKER_MECHANISMS=SCRAM-SHA-512 or other
KAFKA_BROKER_SECURITY_PROTOCOL=SASL_SSL or other
KAFKA_BROKER_MECHANISMS=SCRAM-SHA-512
KAFKA_BROKER_SECURITY_PROTOCOL=SASL_SSL
```

## License
Expand Down

0 comments on commit 121befa

Please sign in to comment.