From 50a4203410772868f1b8f236d7abcea41a784dd2 Mon Sep 17 00:00:00 2001 From: Mashhur Date: Wed, 26 Feb 2025 16:23:36 -0800 Subject: [PATCH 1/2] Upgrade elasticsearch-ruby client. --- Gemfile.template | 1 - logstash-core/logstash-core.gemspec | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile.template b/Gemfile.template index bc2c7a7d394..e9c1bb9ee99 100644 --- a/Gemfile.template +++ b/Gemfile.template @@ -13,7 +13,6 @@ gem "ruby-maven-libs", "~> 3", ">= 3.9.6.1" gem "logstash-output-elasticsearch", ">= 11.14.0" gem "polyglot", require: false gem "treetop", require: false -gem "faraday", "~> 1", :require => false # due elasticsearch-transport (elastic-transport) depending faraday '~> 1' gem "minitar", "~> 1", :group => :build gem "childprocess", "~> 4", :group => :build gem "fpm", "~> 1", ">= 1.14.1", :group => :build # compound due to bugfix https://github.com/jordansissel/fpm/pull/1856 diff --git a/logstash-core/logstash-core.gemspec b/logstash-core/logstash-core.gemspec index bb1a043e189..43b4258974d 100644 --- a/logstash-core/logstash-core.gemspec +++ b/logstash-core/logstash-core.gemspec @@ -39,7 +39,7 @@ Gem::Specification.new do |gem| gem.email = ["info@elastic.co"] gem.description = %q{The core components of logstash, the scalable log and event management tool} gem.summary = %q{logstash-core - The core components of logstash} - gem.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html" + gem.homepage = "https://www.elastic.co/logstash" gem.license = "Apache-2.0" gem.files = Dir.glob( @@ -78,7 +78,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency "jrjackson", "= #{ALL_VERSIONS.fetch('jrjackson')}" #(Apache 2.0 license) - gem.add_runtime_dependency "elasticsearch", '~> 7' + gem.add_runtime_dependency "elasticsearch", '~> 8' gem.add_runtime_dependency "manticore", '~> 0.6' # xpack geoip database service From 3cfcc814c2b0da640c017d96f04b64194127132f Mon Sep 17 00:00:00 2001 From: Mashhur Date: Mon, 3 Mar 2025 15:46:18 -0800 Subject: [PATCH 2/2] Fix Faraday removed basic auth option and apply the ES client module name change. --- logstash-core/spec/logstash/webserver_spec.rb | 4 ++-- qa/integration/specs/dlq_spec.rb | 4 ++-- x-pack/qa/integration/management/multiple_pipelines_spec.rb | 2 +- .../monitoring/es_documents_structure_validation_spec.rb | 4 ++-- x-pack/qa/integration/support/helpers.rb | 2 +- x-pack/qa/integration/support/shared_examples.rb | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/logstash-core/spec/logstash/webserver_spec.rb b/logstash-core/spec/logstash/webserver_spec.rb index 048a4563d3b..e5e2c4e379d 100644 --- a/logstash-core/spec/logstash/webserver_spec.rb +++ b/logstash-core/spec/logstash/webserver_spec.rb @@ -191,7 +191,7 @@ def free_ports(servers) context "and invalid basic auth is provided" do it 'emits an HTTP 401 with WWW-Authenticate header' do response = Faraday.new("http://#{api_host}:#{webserver.port}") do |conn| - conn.request :basic_auth, 'john-doe', 'open-sesame' + conn.request :authorization, :basic, 'john-doe', 'open-sesame' end.get('/') aggregate_failures do expect(response.status).to eq(401) @@ -202,7 +202,7 @@ def free_ports(servers) context "and valid auth is provided" do it "returns a relevant response" do response = Faraday.new("http://#{api_host}:#{webserver.port}") do |conn| - conn.request :basic_auth, 'a-user', 's3cur3dPas!' + conn.request :authorization, :basic, 'a-user', 's3cur3dPas!' end.get('/') aggregate_failures do expect(response.status).to eq(200) diff --git a/qa/integration/specs/dlq_spec.rb b/qa/integration/specs/dlq_spec.rb index 965b39d0c07..db1879d5f57 100644 --- a/qa/integration/specs/dlq_spec.rb +++ b/qa/integration/specs/dlq_spec.rb @@ -83,10 +83,10 @@ try(60) do begin result = es_client.search(index: 'test-index', size: 0, q: '*') - rescue Elasticsearch::Transport::Transport::Errors::ServiceUnavailable => e + rescue Elastic::Transport::Transport::Errors::ServiceUnavailable => e puts "Elasticsearch unavailable #{e.inspect}" hits = 0 - rescue Elasticsearch::Transport::Transport::Errors::NotFound => e + rescue Elastic::Transport::Transport::Errors::NotFound => e puts "Index not found" hits = 0 end diff --git a/x-pack/qa/integration/management/multiple_pipelines_spec.rb b/x-pack/qa/integration/management/multiple_pipelines_spec.rb index a7b66de6f3a..612f4cd8e79 100644 --- a/x-pack/qa/integration/management/multiple_pipelines_spec.rb +++ b/x-pack/qa/integration/management/multiple_pipelines_spec.rb @@ -138,7 +138,7 @@ def count_hashes(pipelines) begin res = elasticsearch_client.search(index: '.monitoring-logstash-*', body: query) - rescue Elasticsearch::Transport::Transport::Errors::ServiceUnavailable + rescue Elastic::Transport::Transport::Errors::ServiceUnavailable return nil end diff --git a/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb b/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb index f471153180a..94fb9b7b5dd 100644 --- a/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb +++ b/x-pack/qa/integration/monitoring/es_documents_structure_validation_spec.rb @@ -19,8 +19,8 @@ let(:retryable_errors) do [NoMethodError, RSpec::Expectations::ExpectationNotMetError, - Elasticsearch::Transport::Transport::Errors::ServiceUnavailable, - Elasticsearch::Transport::Transport::Errors::NotFound] + Elastic::Transport::Transport::Errors::ServiceUnavailable, + Elastic::Transport::Transport::Errors::NotFound] end describe "metrics" do diff --git a/x-pack/qa/integration/support/helpers.rb b/x-pack/qa/integration/support/helpers.rb index a216d1cd8d4..0122b8dbab1 100644 --- a/x-pack/qa/integration/support/helpers.rb +++ b/x-pack/qa/integration/support/helpers.rb @@ -124,7 +124,7 @@ def cleanup_system_indices(pipeline_ids) pipeline_ids.each do |id| begin elasticsearch_client.perform_request(:delete, "_logstash/pipeline/#{id}") - rescue Elasticsearch::Transport::Transport::Errors::NotFound => e + rescue Elastic::Transport::Transport::Errors::NotFound => e puts ".logstash can be empty #{e.message}" end end diff --git a/x-pack/qa/integration/support/shared_examples.rb b/x-pack/qa/integration/support/shared_examples.rb index 5c8a54f00f3..e3890339608 100644 --- a/x-pack/qa/integration/support/shared_examples.rb +++ b/x-pack/qa/integration/support/shared_examples.rb @@ -9,8 +9,8 @@ let(:retryable_errors) do [NoMethodError, RSpec::Expectations::ExpectationNotMetError, - Elasticsearch::Transport::Transport::Errors::ServiceUnavailable, - Elasticsearch::Transport::Transport::Errors::NotFound] + Elastic::Transport::Transport::Errors::ServiceUnavailable, + Elastic::Transport::Transport::Errors::NotFound] end describe "metrics" do