logstash-input-elasticsearch 4.21.1 → 5.0.0

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: b34b6c6d814152e88f320525ea0bb80bbf1e63ff962e022aaac0a2385dd087b6
4
+ data.tar.gz: d142df9148ad69bf838d62badeec71382118741938db61e6aad0676bdb918a37
5
5
  SHA512:
6
- metadata.gz: ff1d841fbd5cbe0469a704131bd55b206c418243e87b3afac4e4d0d3ef26af6e926148323ec6c939fd48ea53bf4e0d4fcdb09ea1015d2d815863db917ff322c5
7
- data.tar.gz: 66fbdcc42a51b8859be13df832d7d5e5c2a71e53c8995c490d64316590f74d277d6ed73d8b366a580fe5dfb085205999d0488368e1c62c37dc83ad3a74e08fad
6
+ metadata.gz: 19b2b1325ded83b5b93966365f855f104ba1881f2c991ffdbe92216e08d12d18a7b3ddd4a14d755f6d55c85c98e00d12ca566188c63706d6db1f0aa5b085048b
7
+ data.tar.gz: ff5de17e75281d8ddd0be70167f2c4dee0a90eef328c7e486b704e79fe10db7b7108b733f77438386a7abb18d504efbef5aaf7b0f34a6c8edd62791640514b7b
data/CHANGELOG.md CHANGED
@@ -1,9 +1,10 @@
1
- ## 4.21.1
2
- - Fix: prevent plugin crash when hits contain illegal structure [#183](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/183)
3
- - 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.
4
-
5
- ## 4.21.0
6
- - Add support for custom headers [#217](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/217)
1
+ ## 5.0.0
2
+ - SSL settings that were marked deprecated in version `4.17.0` are now marked obsolete, and will prevent the plugin from starting.
3
+ - These settings are:
4
+ - `ssl`, which should bre replaced by `ssl_enabled`
5
+ - `ca_file`, which should bre replaced by `ssl_certificate_authorities`
6
+ - `ssl_certificate_verification`, which should bre replaced by `ssl_verification_mode`
7
+ - [#213](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/213)
7
8
 
8
9
  ## 4.20.5
9
10
  - Add `x-elastic-product-origin` header to Elasticsearch requests [#211](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/211)
data/docs/index.asciidoc CHANGED
@@ -93,20 +93,16 @@ The plugin logs a warning when ECS is enabled and `target` isn't set.
93
93
 
94
94
  TIP: Set the `target` option to avoid potential schema conflicts.
95
95
 
96
- [id="plugins-{type}s-{plugin}-failure-handling"]
97
- ==== Failure handling
98
-
99
- When this input plugin cannot create a structured `Event` from a hit result, it will instead create an `Event` that is tagged with `_elasticsearch_input_failure` whose `[event][original]` is a JSON-encoded string representation of the entire hit.
100
-
101
- Common causes are:
102
-
103
- - When the hit result contains top-level fields that are {logstash-ref}/processing.html#reserved-fields[reserved in Logstash] but do not have the expected shape. Use the <<plugins-{type}s-{plugin}-target>> directive to avoid conflicts with the top-level namespace.
104
- - When <<plugins-{type}s-{plugin}-docinfo>> is enabled and the docinfo fields cannot be merged into the hit result. Combine <<plugins-{type}s-{plugin}-target>> and <<plugins-{type}s-{plugin}-docinfo_target>> to avoid conflict.
105
-
106
96
  [id="plugins-{type}s-{plugin}-options"]
107
97
  ==== Elasticsearch Input configuration options
108
98
 
109
- This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> and the <<plugins-{type}s-{plugin}-deprecated-options>> described later.
99
+ This plugin supports these configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
100
+
101
+ NOTE: As of version `5.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
102
+ Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
103
+
104
+ NOTE: As of version `5.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
105
+ Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
110
106
 
111
107
  [cols="<,<,<",options="header",]
112
108
  |=======================================================================
@@ -499,6 +495,8 @@ Enable SSL/TLS secured communication to Elasticsearch cluster.
499
495
  Leaving this unspecified will use whatever scheme is specified in the URLs listed in <<plugins-{type}s-{plugin}-hosts>> or extracted from the <<plugins-{type}s-{plugin}-cloud_id>>.
500
496
  If no explicit protocol is specified plain HTTP will be used.
501
497
 
498
+ When not explicitly set, SSL will be automatically enabled if any of the specified hosts use HTTPS.
499
+
502
500
  [id="plugins-{type}s-{plugin}-ssl_key"]
503
501
  ===== `ssl_key`
504
502
  * Value type is <<path,path>>
@@ -629,56 +627,21 @@ option when authenticating to the Elasticsearch server. If set to an
629
627
  empty string authentication will be disabled.
630
628
 
631
629
 
632
- [id="plugins-{type}s-{plugin}-deprecated-options"]
633
- ==== Elasticsearch Input deprecated configuration options
630
+ [id="plugins-{type}s-{plugin}-obsolete-options"]
631
+ ==== Elasticsearch Input Obsolete Configuration Options
634
632
 
635
- This plugin supports the following deprecated configurations.
633
+ WARNING: As of version `5.0.0` of this plugin, some configuration options have been replaced.
634
+ The plugin will fail to start if it contains any of these obsolete options.
636
635
 
637
- WARNING: Deprecated options are subject to removal in future releases.
638
636
 
639
- [cols="<,<,<",options="header",]
637
+ [cols="<,<",options="header",]
640
638
  |=======================================================================
641
- |Setting|Input type|Replaced by
642
- | <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
643
- | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|<<plugins-{type}s-{plugin}-ssl_enabled>>
644
- | <<plugins-{type}s-{plugin}-ssl_certificate_verification>> |<<boolean,boolean>>|<<plugins-{type}s-{plugin}-ssl_verification_mode>>
639
+ |Setting|Replaced by
640
+ | ca_file | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
641
+ | ssl | <<plugins-{type}s-{plugin}-ssl_enabled>>
642
+ | ssl_certificate_verification | <<plugins-{type}s-{plugin}-ssl_verification_mode>>
645
643
  |=======================================================================
646
644
 
647
- [id="plugins-{type}s-{plugin}-ca_file"]
648
- ===== `ca_file`
649
- deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
650
-
651
- * Value type is <<path,path>>
652
- * There is no default value for this setting.
653
-
654
- SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary.
655
-
656
- [id="plugins-{type}s-{plugin}-ssl"]
657
- ===== `ssl`
658
- deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
659
-
660
- * Value type is <<boolean,boolean>>
661
- * Default value is `false`
662
-
663
- If enabled, SSL will be used when communicating with the Elasticsearch
664
- server (i.e. HTTPS will be used instead of plain HTTP).
665
-
666
-
667
- [id="plugins-{type}s-{plugin}-ssl_certificate_verification"]
668
- ===== `ssl_certificate_verification`
669
- deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_verification_mode>>]
670
-
671
- * Value type is <<boolean,boolean>>
672
- * Default value is `true`
673
-
674
- Option to validate the server's certificate. Disabling this severely compromises security.
675
- When certificate validation is disabled, this plugin implicitly trusts the machine
676
- resolved at the given address without validating its proof-of-identity.
677
- In this scenario, the plugin can transmit credentials to or process data from an untrustworthy
678
- man-in-the-middle or other compromised infrastructure.
679
- More information on the importance of certificate verification:
680
- **https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf**.
681
-
682
645
  [id="plugins-{type}s-{plugin}-common-options"]
683
646
  include::{include_path}/{type}.asciidoc[]
684
647
 
@@ -201,23 +201,12 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
201
201
  # Set the address of a forward HTTP proxy.
202
202
  config :proxy, :validate => :uri_or_empty
203
203
 
204
- # SSL
205
- config :ssl, :validate => :boolean, :default => false, :deprecated => "Set 'ssl_enabled' instead."
206
-
207
- # SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary
208
- config :ca_file, :validate => :path, :deprecated => "Set 'ssl_certificate_authorities' instead."
209
-
210
204
  # OpenSSL-style X.509 certificate certificate to authenticate the client
211
205
  config :ssl_certificate, :validate => :path
212
206
 
213
207
  # SSL Certificate Authority files in PEM encoded format, must also include any chain certificates as necessary
214
208
  config :ssl_certificate_authorities, :validate => :path, :list => true
215
209
 
216
- # Option to validate the server's certificate. Disabling this severely compromises security.
217
- # For more information on the importance of certificate verification please read
218
- # https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
219
- config :ssl_certificate_verification, :validate => :boolean, :default => true, :deprecated => "Set 'ssl_verification_mode' instead."
220
-
221
210
  # The list of cipher suites to use, listed by priorities.
222
211
  # Supported cipher suites vary depending on which version of Java is used.
223
212
  config :ssl_cipher_suites, :validate => :string, :list => true
@@ -245,7 +234,6 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
245
234
  config :ssl_truststore_password, :validate => :password
246
235
 
247
236
  # The JKS truststore to validate the server's certificate.
248
- # Use either `:ssl_truststore_path` or `:ssl_certificate_authorities`
249
237
  config :ssl_truststore_path, :validate => :path
250
238
 
251
239
  # The format of the truststore file. It must be either jks or pkcs12
@@ -267,6 +255,11 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
267
255
  # If set, the _source of each hit will be added nested under the target instead of at the top-level
268
256
  config :target, :validate => :field_reference
269
257
 
258
+ # Obsolete Settings
259
+ config :ssl, :obsolete => "Set 'ssl_enabled' instead."
260
+ config :ca_file, :obsolete => "Set 'ssl_certificate_authorities' instead."
261
+ config :ssl_certificate_verification, :obsolete => "Set 'ssl_verification_mode' instead."
262
+
270
263
  # config :ca_trusted_fingerprint, :validate => :sha_256_hex
271
264
  include LogStash::PluginMixins::CATrustedFingerprintSupport
272
265
 
@@ -353,20 +346,10 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
353
346
  # This can be called externally from the query_executor
354
347
  public
355
348
  def push_hit(hit, output_queue, root_field = '_source')
356
- event = event_from_hit(hit, root_field)
357
- decorate(event)
358
- output_queue << event
359
- end
360
-
361
- def event_from_hit(hit, root_field)
362
349
  event = targeted_event_factory.new_event hit[root_field]
363
350
  set_docinfo_fields(hit, event) if @docinfo
364
-
365
- event
366
- rescue => e
367
- serialized_hit = hit.to_json
368
- logger.warn("Event creation error, original data now in [event][original] field", message: e.message, exception: e.class, data: serialized_hit)
369
- return event_factory.new_event('event' => { 'original' => serialized_hit }, 'tags' => ['_elasticsearch_input_failure'])
351
+ decorate(event)
352
+ output_queue << event
370
353
  end
371
354
 
372
355
  def set_docinfo_fields(hit, event)
@@ -374,8 +357,10 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
374
357
  docinfo_target = event.get(@docinfo_target) || {}
375
358
 
376
359
  unless docinfo_target.is_a?(Hash)
377
- # expect error to be handled by `#event_from_hit`
378
- fail RuntimeError, "Incompatible event; unable to merge docinfo fields into docinfo_target=`#{@docinfo_target}`"
360
+ @logger.error("Incompatible Event, incompatible type for the docinfo_target=#{@docinfo_target} field in the `_source` document, expected a hash got:", :docinfo_target_type => docinfo_target.class, :event => event.to_hash_with_metadata)
361
+
362
+ # TODO: (colin) I am not sure raising is a good strategy here?
363
+ raise Exception.new("Elasticsearch input: incompatible event")
379
364
  end
380
365
 
381
366
  @docinfo_fields.each do |field|
@@ -420,8 +405,6 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
420
405
  ssl_options[:ssl] = true if @ssl_enabled
421
406
 
422
407
  unless @ssl_enabled
423
- # Keep it backward compatible with the deprecated `ssl` option
424
- ssl_options[:trust_strategy] = trust_strategy_for_ca_trusted_fingerprint if original_params.include?('ssl')
425
408
  return ssl_options
426
409
  end
427
410
 
@@ -485,38 +468,11 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
485
468
  end
486
469
 
487
470
  def setup_ssl_params!
488
- @ssl_enabled = normalize_config(:ssl_enabled) do |normalize|
489
- normalize.with_deprecated_alias(:ssl)
471
+ # Only infer ssl_enabled if it wasn't explicitly set
472
+ unless original_params.include?('ssl_enabled')
473
+ @ssl_enabled = effectively_ssl?
474
+ params['ssl_enabled'] = @ssl_enabled
490
475
  end
491
-
492
- # Infer the value if neither the deprecate `ssl` and `ssl_enabled` were set
493
- infer_ssl_enabled_from_hosts
494
-
495
- @ssl_certificate_authorities = normalize_config(:ssl_certificate_authorities) do |normalize|
496
- normalize.with_deprecated_mapping(:ca_file) do |ca_file|
497
- [ca_file]
498
- end
499
- end
500
-
501
- @ssl_verification_mode = normalize_config(:ssl_verification_mode) do |normalize|
502
- normalize.with_deprecated_mapping(:ssl_certificate_verification) do |ssl_certificate_verification|
503
- if ssl_certificate_verification == true
504
- "full"
505
- else
506
- "none"
507
- end
508
- end
509
- end
510
-
511
- params['ssl_enabled'] = @ssl_enabled
512
- params['ssl_certificate_authorities'] = @ssl_certificate_authorities unless @ssl_certificate_authorities.nil?
513
- params['ssl_verification_mode'] = @ssl_verification_mode unless @ssl_verification_mode.nil?
514
- end
515
-
516
- def infer_ssl_enabled_from_hosts
517
- return if original_params.include?('ssl') || original_params.include?('ssl_enabled')
518
-
519
- @ssl_enabled = params['ssl_enabled'] = effectively_ssl?
520
476
  end
521
477
 
522
478
  def setup_hosts
@@ -1,7 +1,7 @@
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 = '5.0.0'
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"
@@ -1,19 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDFTCCAf2gAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylFbGFz
3
- dGljIENlcnRpZmljYX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C4Ndft36
18
+ NBQ9mZpequ4RYjpSZNLcVsxyFAYwEY4g8MvH0MoMo2RRLfehmMCzXnI/Wh2qEyYz
19
+ emHprBii/5y1HieKXlX9CZRb5qEPHckDVXW3znw=
19
20
  -----END CERTIFICATE-----
@@ -1 +1 @@
1
- b1e955819b0d14f64f863adb103c248ddacf2e17bea48d04ee4b57c64814ccc4
1
+ 195a7e7b1bc29f3d7913a918a44721704d27fa56facea0cd72a8093c7107c283
@@ -1,19 +1,20 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDIzCCAgugAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylFbGFz
3
- dGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTAeFw0yNDEyMjYy
4
- MjI3MTVaFw0yNTEyMjYyMjI3MTVaMA0xCzAJBgNVBAMTAmVzMIIBIjANBgkqhkiG
5
- 9w0BAQEFAAOCAQ8AMIIBCgKCAQEArZLZvLSWDK7Ul+AaBnjU81dsfaow8zOjCC5V
6
- V21nXpYzQJoQbuWcvGYxwL7ZDs2ca4Wc8BVCj1NDduHuP7U+QIlUdQpl8kh5a0Zz
7
- 36pcFw7UyF51/AzWixJrht/Azzkb5cpZtE22ZK0KhS4oCsjJmTN0EABAsGhDI9/c
8
- MjNrUC7iP0dvfOuzAPp7ufY83h98jKKXUYV24snbbvmqoWI6GQQNSG/sEo1+1UGH
9
- /z07/mVKoBAa5DVoNGvxN0fCE7vW7hkhT8+frJcsYFatAbnf6ql0KzEa8lN9u0gR
10
- hQNM3zcKKsjEMomBzVBc4SV3KXO0d/jGdDtlqsm2oXqlTMdtGwIDAQABo2cwZTAY
11
- BgNVHREEETAPgg1lbGFzdGljc2VhcmNoMAkGA1UdEwQCMAAwHQYDVR0OBBYEFFQU
12
- K+6Cg2kExRj1xSDzEi4kkgKXMB8GA1UdIwQYMBaAFMgkye5+2l+TE0I6RsXRHjGB
13
- wpBGMA0GCSqGSIb3DQEB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4kkgKX
12
+ MB8GA1UdIwQYMBaAFMgkye5+2l+TE0I6RsXRHjGBwpBGMBgGA1UdEQQRMA+CDWVs
13
+ YXN0aWNzZWFyY2gwCQYDVR0TBAIwADANBgkqhkiG9w0BAQsFAAOCAQEAinaknZIc
14
+ 7xtQNwUwa+kdET+I4lMz+TJw9vTjGKPJqe082n81ycKU5b+a/OndG90z+dTwhShW
15
+ f0oZdIe/1rDCdiRU4ceCZA4ybKrFDIbW8gOKZOx9rsgEx9XNELj4ocZTBqxjQmNE
16
+ Ho91fli5aEm0EL2vJgejh4hcfDeElQ6go9gtvAHQ57XEADQSenvt69jOICOupnS+
17
+ LSjDVhv/VLi3CAip0B+lD5fX/DVQdrJ62eRGuQYxoouE3saCO58qUUrKB39yD9KA
18
+ qRA/sVxyLogxaU+5dLfc0NJdOqSzStxQ2vdMvAWo9tZZ2UBGFrk5SdwCQe7Yv5mX
19
+ qi02i4q6meHGcw==
19
20
  -----END CERTIFICATE-----
@@ -58,6 +58,19 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
58
58
  end
59
59
  end
60
60
 
61
+ describe 'handling obsolete settings' do
62
+ [{:name => 'ssl', :replacement => 'ssl_enabled', :sample_value => true},
63
+ {:name => 'ca_file', :replacement => 'ssl_certificate_authorities', :sample_value => 'spec/fixtures/test_certs/ca.crt'},
64
+ {:name => 'ssl_certificate_verification', :replacement => 'ssl_verification_mode', :sample_value => false }].each do | obsolete_setting|
65
+ context "with obsolete #{obsolete_setting[:name]}" do
66
+ let (:config) { {obsolete_setting[:name] => obsolete_setting[:sample_value]} }
67
+ it "should raise a config error with the appropriate message" do
68
+ expect { plugin.register }.to raise_error LogStash::ConfigurationError, /The setting `#{obsolete_setting[:name]}` in plugin `elasticsearch` is obsolete and is no longer available. Set '#{obsolete_setting[:replacement]}' instead/i
69
+ end
70
+ end
71
+ end
72
+ end
73
+
61
74
  context "against not authentic Elasticsearch" do
62
75
  before(:each) do
63
76
  Elasticsearch::Client.send(:define_method, :ping) { raise Elasticsearch::UnsupportedProductError.new("Fake error") } # define error ping method
@@ -653,28 +666,11 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
653
666
  context 'if the `docinfo_target` exist but is not of type hash' do
654
667
  let(:config) { base_config.merge 'docinfo' => true, "docinfo_target" => 'metadata_with_string' }
655
668
  let(:do_register) { false }
656
- let(:mock_queue) { double('Queue', :<< => nil) }
657
- let(:hit) { response.dig('hits', 'hits').first }
658
-
659
- it 'emits a tagged event with JSON-serialized event in [event][original]' do
660
- allow(plugin).to receive(:logger).and_return(double('Logger').as_null_object)
661
669
 
670
+ it 'raises an exception if the `docinfo_target` exist but is not of type hash' do
671
+ expect(client).not_to receive(:clear_scroll)
662
672
  plugin.register
663
- plugin.run(mock_queue)
664
-
665
- expect(mock_queue).to have_received(:<<) do |event|
666
- expect(event).to be_a_kind_of LogStash::Event
667
-
668
- expect(event.get('tags')).to include("_elasticsearch_input_failure")
669
- expect(event.get('[event][original]')).to be_a_kind_of String
670
- expect(JSON.load(event.get('[event][original]'))).to eq hit
671
- end
672
-
673
- expect(plugin.logger)
674
- .to have_received(:warn).with(
675
- a_string_including("Event creation error, original data now in [event][original] field"),
676
- a_hash_including(:message => a_string_including('unable to merge docinfo fields into docinfo_target=`metadata_with_string`'),
677
- :data => a_string_including('"_id":"C5b2xLQwTZa76jBmHIbwHQ"')))
673
+ expect { plugin.run([]) }.to raise_error(Exception, /incompatible event/)
678
674
  end
679
675
 
680
676
  end
@@ -1252,88 +1248,6 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
1252
1248
  end
1253
1249
  end
1254
1250
 
1255
- context '#push_hit' do
1256
- let(:config) do
1257
- {
1258
- 'docinfo' => true, # include ids
1259
- 'docinfo_target' => '[@metadata][docinfo]'
1260
- }
1261
- end
1262
-
1263
- let(:hit) do
1264
- JSON.load(<<~EOJSON)
1265
- {
1266
- "_index" : "test_bulk_index_2",
1267
- "_type" : "_doc",
1268
- "_id" : "sHe6A3wBesqF7ydicQvG",
1269
- "_score" : 1.0,
1270
- "_source" : {
1271
- "@timestamp" : "2021-09-20T15:02:02.557Z",
1272
- "message" : "ping",
1273
- "@version" : "17",
1274
- "sequence" : 7,
1275
- "host" : {
1276
- "name" : "maybe.local",
1277
- "ip" : "127.0.0.1"
1278
- }
1279
- }
1280
- }
1281
- EOJSON
1282
- end
1283
-
1284
- let(:mock_queue) { double('queue', :<< => nil) }
1285
-
1286
- it 'pushes a generated event to the queue' do
1287
- plugin.send(:push_hit, hit, mock_queue)
1288
- expect(mock_queue).to have_received(:<<) do |event|
1289
- expect(event).to be_a_kind_of LogStash::Event
1290
-
1291
- # fields overriding defaults
1292
- expect(event.timestamp.to_s).to eq("2021-09-20T15:02:02.557Z")
1293
- expect(event.get('@version')).to eq("17")
1294
-
1295
- # structure from hit's _source
1296
- expect(event.get('message')).to eq("ping")
1297
- expect(event.get('sequence')).to eq(7)
1298
- expect(event.get('[host][name]')).to eq("maybe.local")
1299
- expect(event.get('[host][ip]')).to eq("127.0.0.1")
1300
-
1301
- # docinfo fields
1302
- expect(event.get('[@metadata][docinfo][_index]')).to eq("test_bulk_index_2")
1303
- expect(event.get('[@metadata][docinfo][_type]')).to eq("_doc")
1304
- expect(event.get('[@metadata][docinfo][_id]')).to eq("sHe6A3wBesqF7ydicQvG")
1305
- end
1306
- end
1307
-
1308
- context 'when event creation fails' do
1309
- before(:each) do
1310
- allow(plugin).to receive(:logger).and_return(double('Logger').as_null_object)
1311
-
1312
- allow(plugin.event_factory).to receive(:new_event).and_call_original
1313
- allow(plugin.event_factory).to receive(:new_event).with(a_hash_including hit['_source']).and_raise(RuntimeError, 'intentional')
1314
- end
1315
-
1316
- it 'pushes a tagged event containing a JSON-encoded hit in [event][original]' do
1317
- plugin.send(:push_hit, hit, mock_queue)
1318
-
1319
- expect(mock_queue).to have_received(:<<) do |event|
1320
- expect(event).to be_a_kind_of LogStash::Event
1321
-
1322
- expect(event.get('tags')).to include("_elasticsearch_input_failure")
1323
- expect(event.get('[event][original]')).to be_a_kind_of String
1324
- expect(JSON.load(event.get('[event][original]'))).to eq hit
1325
- end
1326
-
1327
- expect(plugin.logger)
1328
- .to have_received(:warn).with(
1329
- a_string_including("Event creation error, original data now in [event][original] field"),
1330
- a_hash_including(:message => a_string_including('intentional'),
1331
- :data => a_string_including('"_id":"sHe6A3wBesqF7ydicQvG"')))
1332
-
1333
- end
1334
- end
1335
- end
1336
-
1337
1251
  # @note can be removed once we depends on elasticsearch gem >= 6.x
1338
1252
  def extract_transport(client) # on 7.x client.transport is a ES::Transport::Client
1339
1253
  client.transport.respond_to?(:transport) ? client.transport.transport : client.transport
@@ -4,7 +4,7 @@ require "logstash/plugin"
4
4
  require "logstash/inputs/elasticsearch"
5
5
  require_relative "../../../spec/es_helper"
6
6
 
7
- describe LogStash::Inputs::Elasticsearch do
7
+ describe LogStash::Inputs::Elasticsearch, :integration => true do
8
8
 
9
9
  SECURE_INTEGRATION = ENV['SECURE_INTEGRATION'].eql? 'true'
10
10
 
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: 5.0.0
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: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -277,14 +277,11 @@ files:
277
277
  - lib/logstash/inputs/elasticsearch/patches/_elasticsearch_transport_http_manticore.rb
278
278
  - logstash-input-elasticsearch.gemspec
279
279
  - spec/es_helper.rb
280
- - spec/fixtures/test_certs/GENERATED_AT
281
280
  - spec/fixtures/test_certs/ca.crt
282
281
  - spec/fixtures/test_certs/ca.der.sha256
283
282
  - spec/fixtures/test_certs/ca.key
284
- - spec/fixtures/test_certs/es.chain.crt
285
283
  - spec/fixtures/test_certs/es.crt
286
284
  - spec/fixtures/test_certs/es.key
287
- - spec/fixtures/test_certs/renew.sh
288
285
  - spec/inputs/elasticsearch_spec.rb
289
286
  - spec/inputs/elasticsearch_ssl_spec.rb
290
287
  - spec/inputs/integration/elasticsearch_spec.rb
@@ -316,14 +313,11 @@ specification_version: 4
316
313
  summary: Reads query results from an Elasticsearch cluster
317
314
  test_files:
318
315
  - spec/es_helper.rb
319
- - spec/fixtures/test_certs/GENERATED_AT
320
316
  - spec/fixtures/test_certs/ca.crt
321
317
  - spec/fixtures/test_certs/ca.der.sha256
322
318
  - spec/fixtures/test_certs/ca.key
323
- - spec/fixtures/test_certs/es.chain.crt
324
319
  - spec/fixtures/test_certs/es.crt
325
320
  - spec/fixtures/test_certs/es.key
326
- - spec/fixtures/test_certs/renew.sh
327
321
  - spec/inputs/elasticsearch_spec.rb
328
322
  - spec/inputs/elasticsearch_ssl_spec.rb
329
323
  - spec/inputs/integration/elasticsearch_spec.rb
@@ -1 +0,0 @@
1
- 2024-12-26T22:27:15+00:00
@@ -1,38 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDIzCCAgugAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylFbGFz
3
- dGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTAeFw0yNDEyMjYy
4
- MjI3MTVaFw0yNTEyMjYyMjI3MTVaMA0xCzAJBgNVBAMTAmVzMIIBIjANBgkqhkiG
5
- 9w0BAQEFAAOCAQ8AMIIBCgKCAQEArZLZvLSWDK7Ul+AaBnjU81dsfaow8zOjCC5V
6
- V21nXpYzQJoQbuWcvGYxwL7ZDs2ca4Wc8BVCj1NDduHuP7U+QIlUdQpl8kh5a0Zz
7
- 36pcFw7UyF51/AzWixJrht/Azzkb5cpZtE22ZK0KhS4oCsjJmTN0EABAsGhDI9/c
8
- MjNrUC7i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66xG4Y2zO13gRC+rBwyvxe+c01pqV6ukw6isIbJIQWs1/
26
- QfEMhUwYwKs6/UXxK+VwardcA2zYwngXbGGEtms+mpUfH5CdJnrqW7lHz1BVK4yH
27
- 90IzGE0GU4D90OW/L4QkGX0fv3VQbL8KGFKBoF04pXIaSGMStFN4wirutHtQboYv
28
- 99X4kbLjVSIuubUpA/v9dUP1TNl8ar+HKUWRM96ijHkFTF3FR0NnZyt44gP5qC0h
29
- i4lUiR6Uo9D6WMFjeRYFF7GolCy/I1SzWBmmOnNhQLO5VxcNG4ldhBcapZeGwE98
30
- m/5lxLIwgFR9ZP8bXdxZTWLC58/LQ2NqOjA9mwIDAQABozIwMDAPBgNVHRMBAf8E
31
- BTADAQH/MB0GA1UdDgQWBBTIJMnuftpfkxNCOkbF0R4xgcKQRjANBgkqhkiG9w0B
32
- AQsFAAOCAQEAhfg/cmXc4Uh90yiXU8jOW8saQjTsq4ZMDQiLfJsNmNNYmHFN0vhv
33
- lJRI1STdy7+GpjS5QbrMjQIxWSS8X8xysE4Rt81IrWmLuao35TRFyoiE1seBQ5sz
34
- p/BxZUe57JvWi9dyzv2df4UfWFdGBhzdr80odZmz4i5VIv6qCKJKsGikcuLpepmp
35
- E/UKnKHeR/dFWsxzA9P2OzHTUNBMOOA2PyAUL49pwoChwJeOWN/zAgwMWLbuHFG0
36
- IN0u8swAmeH98QdvzbhiOatGNpqfTNvQEDc19yVjfXKpBVZQ79WtronYSqrbrUa1
37
- T2zD8bIVP7CdddD/UmpT1SSKh4PJxudy5Q==
38
- -----END CERTIFICATE-----
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
- cd "$(dirname "$0")"
5
-
6
- openssl x509 -x509toreq -in ca.crt -copy_extensions copyall -signkey ca.key -out ca.csr
7
- openssl x509 -req -copy_extensions copyall -days 365 -in ca.csr -set_serial 0x01 -signkey ca.key -out ca.crt && rm ca.csr
8
- openssl x509 -in ca.crt -outform der | sha256sum | awk '{print $1}' > ca.der.sha256
9
-
10
- openssl x509 -x509toreq -in es.crt -copy_extensions copyall -signkey es.key -out es.csr
11
- openssl x509 -req -copy_extensions copyall -days 365 -in es.csr -set_serial 0x01 -CA ca.crt -CAkey ca.key -out es.crt && rm es.csr
12
- cat es.crt ca.crt > es.chain.crt
13
-
14
- # output ISO8601 timestamp to file
15
- date -Iseconds > GENERATED_AT