From 3b9939859183ca8d92e9074da384e08a0401f2ad Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 13 Feb 2024 10:33:55 -0500 Subject: [PATCH] Fix: remove warning message on cluster UUID retrieval failure with AOSS. Signed-off-by: dblock --- .../plugin_mixins/opensearch/common.rb | 1 + ...h-output-opensearch-release-notes-2.0.1.md | 4 ++++ ...h-output-opensearch-release-notes-2.0.2.md | 2 ++ ...sh-output-opensearch-release-notes-next.md | 11 +++++++++ spec/unit/outputs/opensearch_spec.rb | 24 +++++++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 release-notes/logstash-output-opensearch-release-notes-next.md diff --git a/lib/logstash/plugin_mixins/opensearch/common.rb b/lib/logstash/plugin_mixins/opensearch/common.rb index ee153603..525e3bf6 100644 --- a/lib/logstash/plugin_mixins/opensearch/common.rb +++ b/lib/logstash/plugin_mixins/opensearch/common.rb @@ -87,6 +87,7 @@ def after_successful_connection(&block) def discover_cluster_uuid return unless defined?(plugin_metadata) + return if params && params['auth_type'] && params['auth_type']['service_name'] == "aoss" # AOSS doesn't support GET / cluster_info = client.get('/') plugin_metadata.set(:cluster_uuid, cluster_info['cluster_uuid']) rescue => e diff --git a/release-notes/logstash-output-opensearch-release-notes-2.0.1.md b/release-notes/logstash-output-opensearch-release-notes-2.0.1.md index 8e8f651d..30ac4bed 100644 --- a/release-notes/logstash-output-opensearch-release-notes-2.0.1.md +++ b/release-notes/logstash-output-opensearch-release-notes-2.0.1.md @@ -1,12 +1,16 @@ ## Version 2.0.1 Release Notes + Compatible with OpenSearch 1.3+, 2.0+ ### Bug Fixes + * Fix a gzip compression issue when sending partial bulk requests (#183) ### Documentation + * Update the OpenSearch documentation website link for this plugin (#178) * Updated MAINTAINERS.md format. (#185) ### Infrastructure + * Add release workflows (#188) diff --git a/release-notes/logstash-output-opensearch-release-notes-2.0.2.md b/release-notes/logstash-output-opensearch-release-notes-2.0.2.md index 5430925b..fd69e659 100644 --- a/release-notes/logstash-output-opensearch-release-notes-2.0.2.md +++ b/release-notes/logstash-output-opensearch-release-notes-2.0.2.md @@ -3,8 +3,10 @@ Compatible with OpenSearch 1.3+, 2.0+ ### Bug Fixes + * Encode body before signing to match manticore adapter encoding. ([#207](https://github.com/opensearch-project/logstash-output-opensearch/issues/207)) ### Documentation + * Baselines the MAINTAINERS.md and CODEOWNERS files. ([#196](https://github.com/opensearch-project/logstash-output-opensearch/issues/196)) diff --git a/release-notes/logstash-output-opensearch-release-notes-next.md b/release-notes/logstash-output-opensearch-release-notes-next.md new file mode 100644 index 00000000..529b1465 --- /dev/null +++ b/release-notes/logstash-output-opensearch-release-notes-next.md @@ -0,0 +1,11 @@ +## Version 2.0.3 Release Notes + +Compatible with OpenSearch 1.3+, 2.0+ + +### Bug Fixes + +* Fix warning retrieving cluster UUID with Amazon OpenSearch Serverless (#) + +### Documentation + +### Infrastructure diff --git a/spec/unit/outputs/opensearch_spec.rb b/spec/unit/outputs/opensearch_spec.rb index 125a8442..448f187d 100644 --- a/spec/unit/outputs/opensearch_spec.rb +++ b/spec/unit/outputs/opensearch_spec.rb @@ -776,6 +776,30 @@ expect(logger).to have_received(:error).with(/Unable to retrieve OpenSearch cluster uuid/i, anything) end + context 'with iam auth' do + context 'es' do + let(:options) { { 'hosts' => '127.0.0.1:9999', 'auth_type' => { 'service_name' => 'es' } } } + it "logs inability to retrieve uuid" do + allow(subject).to receive(:install_template) + subject.register + subject.send :wait_for_successful_connection + + expect(logger).to have_received(:error).with(/Unable to retrieve OpenSearch cluster uuid/i, anything) + end + end + + context 'aoss' do + let(:options) { { 'hosts' => '127.0.0.1:9999', 'auth_type' => { 'service_name' => 'aoss' } } } + it "does not attempt to retrieve uuid" do + allow(subject).to receive(:install_template) + subject.register + subject.send :wait_for_successful_connection + + expect(logger).to_not have_received(:error) + end + end + end + it "logs template install failure" do allow(subject).to receive(:discover_cluster_uuid) subject.register