Skip to content

Commit 1a5e705

Browse files
committed
Exposing sasl.jaas.config setting
1 parent edcc277 commit 1a5e705

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

docs/index.asciidoc

+19
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ https://kafka.apache.org/documentation for more details.
105105
| <<plugins-{type}s-{plugin}-reconnect_backoff_ms>> |<<string,string>>|No
106106
| <<plugins-{type}s-{plugin}-request_timeout_ms>> |<<string,string>>|No
107107
| <<plugins-{type}s-{plugin}-retry_backoff_ms>> |<<string,string>>|No
108+
| <<plugins-{type}s-{plugin}-sasl_jaas_config>> |<<string,string>>|No
108109
| <<plugins-{type}s-{plugin}-sasl_kerberos_service_name>> |<<string,string>>|No
109110
| <<plugins-{type}s-{plugin}-sasl_mechanism>> |<<string,string>>|No
110111
| <<plugins-{type}s-{plugin}-security_protocol>> |<<string,string>>, one of `["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"]`|No
@@ -421,6 +422,24 @@ retries are exhausted.
421422
The amount of time to wait before attempting to retry a failed fetch request
422423
to a given topic partition. This avoids repeated fetching-and-failing in a tight loop.
423424

425+
[id="plugins-{type}s-{plugin}-sasl_jaas_config"]
426+
===== `sasl_jaas_config`
427+
428+
* Value type is <<string,string>>
429+
* There is no default value for this setting.
430+
431+
JAAS configuration setting local to this plugin instance, as opposed to settings using config file configured using `jaas_path`, which are shared across the JVM. This allows each plugin instance to have its own configuration.
432+
433+
If both `sasl_jaas_config` and `jaas_path` configurations are set, the setting here takes precedence.
434+
435+
Example (setting for Azure Event Hub):
436+
[source,ruby]
437+
input {
438+
kafka {
439+
sasl_jaas_config => "org.apache.kafka.common.security.plain.PlainLoginModule required username='auser' password='apassword';"
440+
}
441+
}
442+
424443
[id="plugins-{type}s-{plugin}-sasl_kerberos_service_name"]
425444
===== `sasl_kerberos_service_name`
426445

lib/logstash/inputs/kafka.rb

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ class LogStash::Inputs::Kafka < LogStash::Inputs::Base
201201
# `jaas_path` and `kerberos_config`. If this is not desirable, you would have to run separate instances of Logstash on
202202
# different JVM instances.
203203
config :jaas_path, :validate => :path
204+
# JAAS configuration settings. This allows JAAS config to be a part of the plugin configuration and allows for different JAAS configuration per each plugin config.
205+
config :sasl_jaas_config, :validate => :string
204206
# Optional path to kerberos config file. This is krb5.conf style as detailed in https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html
205207
config :kerberos_config, :validate => :path
206208
# Option to add Kafka metadata like topic, message size to the event.
@@ -355,5 +357,6 @@ def set_sasl_config(props)
355357
end
356358

357359
props.put("sasl.kerberos.service.name",sasl_kerberos_service_name) unless sasl_kerberos_service_name.nil?
360+
props.put("sasl.jaas.config", sasl_jaas_config) unless sasl_jaas_config.nil?
358361
end
359362
end #class LogStash::Inputs::Kafka

0 commit comments

Comments
 (0)