Skip to content

Commit

Permalink
Support multiple kafka bootstrap servers
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Carpio <[email protected]>
  • Loading branch information
ibice authored and poiana committed Jul 25, 2023
1 parent e924ed7 commit 4d11678
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ cliq:
.OutputFields "user.name" }}*' # a Go template to format Cliq Text above Table, displayed in addition to the output from `CLIQ_OUTPUTFORMAT`, see [Slack Message Formatting](#slack-message-formatting) in the README for details. If empty, no Text is displayed before Table.

kafka:
hostport: "" # Apache Kafka Host:Port (ex: localhost:9092). Defaults to port 9092 if no port is specified after the domain, if not empty, Kafka output is enabled
hostport: "" # comma separated list of Apache Kafka bootstrap nodes for establishing the initial connection to the cluster (ex: localhost:9092,localhost:9093). Defaults to port 9092 if no port is specified after the domain, if not empty, Kafka output is enabled
topic: "" # Name of the topic, if not empty, Kafka output is enabled
# minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
sasl: "" # SASL authentication mechanism, if empty, no authentication (PLAIN|SCRAM_SHA256|SCRAM_SHA512)
Expand Down Expand Up @@ -1021,8 +1021,7 @@ care of lower/uppercases**) : `yaml: a.b --> envvar: A_B` :
`CLIQ_OUTPUTFORMAT`, see
[Slack Message Formatting](#slack-message-formatting) in the README for
details. If empty, no Text is displayed before sections.
- **KAFKA_HOSTPORT**: The Host:Port of the Kafka (ex: localhost:9092), if not
empty, Kafka is _enabled_
- **KAFKA_HOSTPORT**: comma separated list of Apache Kafka bootstrap nodes for establishing the initial connection to the cluster (ex: localhost:9092,localhost:9093). Defaults to port 9092 if no port is specified after the domain, if not empty, Kafka output is _enabled_
- **KAFKA_TOPIC**: The name of the Kafka topic
- **KAFKA_sasl**: "" # SASL authentication mechanism, if empty, no authentication (PLAIN|SCRAM_SHA256|SCRAM_SHA512)
- **KAFKA_USERNAME**: use this username to authenticate to Kafka via SASL (default: "")
Expand Down
2 changes: 1 addition & 1 deletion config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ cliq:
messageformat: 'Alert : rule *{{ .Rule }}* triggered by user *{{ index .OutputFields "user.name" }}*' # a Go template to format Cliq Text above Table, displayed in addition to the output from `CLIQ_OUTPUTFORMAT`, see [Slack Message Formatting](#slack-message-formatting) in the README for details. If empty, no Text is displayed before Table.

kafka:
hostport: "" # Apache Kafka Host:Port (ex: localhost:9092). Defaults to port 9092 if no port is specified after the domain, if not empty, Kafka output is enabled
hostport: "" # comma separated list of Apache Kafka bootstrap nodes for establishing the initial connection to the cluster (ex: localhost:9092,localhost:9093). Defaults to port 9092 if no port is specified after the domain, if not empty, Kafka output is enabled
topic: "" # Name of the topic, if not empty, Kafka output is enabled
# minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
sasl: "" # SASL authentication mechanism, if empty, no authentication (PLAIN|SCRAM_SHA256|SCRAM_SHA512)
Expand Down
2 changes: 1 addition & 1 deletion outputs/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewKafkaClient(config *types.Configuration, stats *types.Statistics, promSt
}

kafkaWriter := &kafka.Writer{
Addr: kafka.TCP(config.Kafka.HostPort),
Addr: kafka.TCP(strings.Split(config.Kafka.HostPort, ",")...),
Topic: config.Kafka.Topic,
Async: config.Kafka.Async,
Transport: transport,
Expand Down

0 comments on commit 4d11678

Please sign in to comment.