From 625d7a84e3ff5cefe328d29cabde0e57a527c402 Mon Sep 17 00:00:00 2001 From: Joao Duarte Date: Thu, 23 Apr 2020 10:27:06 +0100 Subject: [PATCH 1/2] move credential and host setup happen to build_client This so that features like logstash license checking can Take an instance of this plugin and extract the http client using the `build_client` method. As cloud id/credential/host setup was happening during register, extracting a client through build_client would result in a partially configured instance. --- lib/logstash/outputs/elasticsearch.rb | 4 ++++ lib/logstash/outputs/elasticsearch/common.rb | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/logstash/outputs/elasticsearch.rb b/lib/logstash/outputs/elasticsearch.rb index c554f9395..344dc01b6 100644 --- a/lib/logstash/outputs/elasticsearch.rb +++ b/lib/logstash/outputs/elasticsearch.rb @@ -255,6 +255,10 @@ def config_init(params) end def build_client + fill_user_password_from_cloud_auth + fill_hosts_from_cloud_id + setup_hosts + params["metric"] = metric if @proxy.eql?('') @logger.warn "Supplied proxy setting (proxy => '') has no effect" diff --git a/lib/logstash/outputs/elasticsearch/common.rb b/lib/logstash/outputs/elasticsearch/common.rb index b94c911ac..963e8eba3 100644 --- a/lib/logstash/outputs/elasticsearch/common.rb +++ b/lib/logstash/outputs/elasticsearch/common.rb @@ -21,9 +21,6 @@ def register # To support BWC, we check if DLQ exists in core (< 5.4). If it doesn't, we use nil to resort to previous behavior. @dlq_writer = dlq_enabled? ? execution_context.dlq_writer : nil - fill_hosts_from_cloud_id - fill_user_password_from_cloud_auth - setup_hosts # properly sets @hosts build_client setup_after_successful_connection check_action_validity From 51ad7fada7b135212607ff7ecbabe19b90e27958 Mon Sep 17 00:00:00 2001 From: Joao Duarte Date: Thu, 23 Apr 2020 11:48:29 +0100 Subject: [PATCH 2/2] bump to 10.4.2 --- CHANGELOG.md | 3 +++ logstash-output-elasticsearch.gemspec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fd941122..8e0666830 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 10.4.2 + - Changed cloud id, credential and host setup to happen in `build_client` [#939](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/939) + ## 10.4.1 - [DOC] Added note about `_type` setting change from `doc` to `_doc` [#884](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/884) diff --git a/logstash-output-elasticsearch.gemspec b/logstash-output-elasticsearch.gemspec index 364234628..5bf8b4ce0 100644 --- a/logstash-output-elasticsearch.gemspec +++ b/logstash-output-elasticsearch.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'logstash-output-elasticsearch' - s.version = '10.4.1' + s.version = '10.4.2' s.licenses = ['apache-2.0'] s.summary = "Stores logs in Elasticsearch"