logstash-input-elasticsearch 4.21.1 → 4.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba4a906467e97c729acee2b28f29350b27ed838bc9d3e8ea0b7cd4a83b4dd06e
4
- data.tar.gz: 2b0c263a32bbcaa0e2d88bb2a070072e95c1a80f6d9794ee267c703e34bed3af
3
+ metadata.gz: 70af2192f555f8afff4ef2f96072f2b215a2039207dfa12a9449f507f7b13f7b
4
+ data.tar.gz: 73621246eccfd1fbb385be5e9ca5ef9a071cdb64008cb539a1e80a08c7a0ed34
5
5
  SHA512:
6
- metadata.gz: ff1d841fbd5cbe0469a704131bd55b206c418243e87b3afac4e4d0d3ef26af6e926148323ec6c939fd48ea53bf4e0d4fcdb09ea1015d2d815863db917ff322c5
7
- data.tar.gz: 66fbdcc42a51b8859be13df832d7d5e5c2a71e53c8995c490d64316590f74d277d6ed73d8b366a580fe5dfb085205999d0488368e1c62c37dc83ad3a74e08fad
6
+ metadata.gz: bbc5c842d77204339e0bb64174f98ffb8bb1728957a1f64d1f83e1f5bad27ad76fc24f44b23a64d23247b26a806cfee7cbd52a16ea34e5490f1355bcdbb98303
7
+ data.tar.gz: 7b258f80ca64e5dd16593a65d7326a5f3695f840cbf32fdeac9363a6a19d4747de9135065a7b940602cd77f43a02910b74d667761184ccb846a864e128334a20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.21.2
2
+ - Add elastic-transport client support used in elasticsearch-ruby 8.x [#225](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/225)
3
+
1
4
  ## 4.21.1
2
5
  - Fix: prevent plugin crash when hits contain illegal structure [#183](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/183)
3
6
  - When a hit cannot be converted to an event, the input now emits an event tagged with `_elasticsearch_input_failure` with an `[event][original]` containing a JSON-encoded string representation of the entire hit.
@@ -13,9 +13,7 @@ require "logstash/plugin_mixins/normalize_config_support"
13
13
  require "base64"
14
14
 
15
15
  require "elasticsearch"
16
- require "elasticsearch/transport/transport/http/manticore"
17
- require_relative "elasticsearch/patches/_elasticsearch_transport_http_manticore"
18
- require_relative "elasticsearch/patches/_elasticsearch_transport_connections_selector"
16
+ require "manticore"
19
17
 
20
18
  # .Compatibility Note
21
19
  # [NOTE]
@@ -323,7 +321,7 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
323
321
  @client_options = {
324
322
  :hosts => hosts,
325
323
  :transport_options => transport_options,
326
- :transport_class => ::Elasticsearch::Transport::Transport::HTTP::Manticore,
324
+ :transport_class => get_transport_client_class,
327
325
  :ssl => ssl_options
328
326
  }
329
327
 
@@ -678,6 +676,20 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
678
676
  end
679
677
  end
680
678
 
679
+ def get_transport_client_class
680
+ # LS-core includes `elasticsearch` gem. The gem is composed of two separate gems: `elasticsearch-api` and `elasticsearch-transport`
681
+ # And now `elasticsearch-transport` is old, instead we have `elastic-transport`.
682
+ # LS-core updated `elasticsearch` > 8: https://github.com/elastic/logstash/pull/17161
683
+ # Following source bits are for the compatibility to support both `elasticsearch-transport` and `elastic-transport` gems
684
+ require "elasticsearch/transport/transport/http/manticore"
685
+ require_relative "elasticsearch/patches/_elasticsearch_transport_http_manticore"
686
+ require_relative "elasticsearch/patches/_elasticsearch_transport_connections_selector"
687
+ ::Elasticsearch::Transport::Transport::HTTP::Manticore
688
+ rescue ::LoadError
689
+ require "elastic/transport/transport/http/manticore"
690
+ ::Elastic::Transport::Transport::HTTP::Manticore
691
+ end
692
+
681
693
  module URIOrEmptyValidator
682
694
  ##
683
695
  # @override to provide :uri_or_empty validator
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-elasticsearch'
4
- s.version = '4.21.1'
4
+ s.version = '4.21.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads query results from an Elasticsearch cluster"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
8
8
  s.authors = ["Elastic"]
9
9
  s.email = 'info@elastic.co'
10
- s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
+ s.homepage = "https://elastic.co/logstash"
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency "logstash-mixin-validator_support", '~> 1.0'
27
27
  s.add_runtime_dependency "logstash-mixin-scheduler", '~> 1.0'
28
28
 
29
- s.add_runtime_dependency 'elasticsearch', '>= 7.17.9'
29
+ s.add_runtime_dependency 'elasticsearch', '>= 7.17.9', '< 9'
30
30
  s.add_runtime_dependency 'logstash-mixin-ca_trusted_fingerprint_support', '~> 1.0'
31
31
  s.add_runtime_dependency 'logstash-mixin-normalize_config_support', '~>1.0'
32
32
 
@@ -21,6 +21,13 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
21
21
  let(:es_version) { "7.5.0" }
22
22
  let(:cluster_info) { {"version" => {"number" => es_version, "build_flavor" => build_flavor}, "tagline" => "You Know, for Search"} }
23
23
 
24
+ def elastic_ruby_v8_client_available?
25
+ Elasticsearch::Transport
26
+ false
27
+ rescue NameError # NameError: uninitialized constant Elasticsearch::Transport if Elastic Ruby client is not available
28
+ true
29
+ end
30
+
24
31
  before(:each) do
25
32
  Elasticsearch::Client.send(:define_method, :ping) { } # define no-action ping method
26
33
  allow_any_instance_of(Elasticsearch::Client).to receive(:info).and_return(cluster_info)
@@ -79,9 +86,11 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
79
86
 
80
87
  before do
81
88
  allow(Elasticsearch::Client).to receive(:new).and_return(es_client)
82
- allow(es_client).to receive(:info).and_raise(
83
- Elasticsearch::Transport::Transport::Errors::BadRequest.new
84
- )
89
+ if elastic_ruby_v8_client_available?
90
+ allow(es_client).to receive(:info).and_raise(Elastic::Transport::Transport::Errors::BadRequest.new)
91
+ else
92
+ allow(es_client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Errors::BadRequest.new)
93
+ end
85
94
  end
86
95
 
87
96
  it "raises an exception" do
@@ -731,8 +740,13 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
731
740
  it "should set host(s)" do
732
741
  plugin.register
733
742
  client = plugin.send(:client)
734
-
735
- expect( client.transport.instance_variable_get(:@seeds) ).to eql [{
743
+ target_field = :@seeds
744
+ begin
745
+ Elasticsearch::Transport::Client
746
+ rescue
747
+ target_field = :@hosts
748
+ end
749
+ expect( client.transport.instance_variable_get(target_field) ).to eql [{
736
750
  :scheme => "https",
737
751
  :host => "ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io",
738
752
  :port => 9243,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.1
4
+ version: 4.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +92,9 @@ dependencies:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: 7.17.9
95
+ - - "<"
96
+ - !ruby/object:Gem::Version
97
+ version: '9'
95
98
  name: elasticsearch
96
99
  type: :runtime
97
100
  prerelease: false
@@ -100,6 +103,9 @@ dependencies:
100
103
  - - ">="
101
104
  - !ruby/object:Gem::Version
102
105
  version: 7.17.9
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '9'
103
109
  - !ruby/object:Gem::Dependency
104
110
  requirement: !ruby/object:Gem::Requirement
105
111
  requirements:
@@ -289,7 +295,7 @@ files:
289
295
  - spec/inputs/elasticsearch_ssl_spec.rb
290
296
  - spec/inputs/integration/elasticsearch_spec.rb
291
297
  - spec/inputs/paginated_search_spec.rb
292
- homepage: http://www.elastic.co/guide/en/logstash/current/index.html
298
+ homepage: https://elastic.co/logstash
293
299
  licenses:
294
300
  - Apache License (2.0)
295
301
  metadata: