logstash-filter-elasticsearch 3.17.0 → 4.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: aaf8d73f069f6550d53c38b1a27f5444f77b774bbe62d66b7b7dd276be4125fc
4
- data.tar.gz: 19b2d5030a25fd03c78baf5edb6b18a649cc0751fa02f38fdfd8a9959669b9bc
3
+ metadata.gz: 015a98dbd36122dd3fc4c74da5744a31f6182f67023f802189cc73e837d5ba7a
4
+ data.tar.gz: 8f1c3a79c0af3fc4154501d16bf775e01b6aa7575627852cb18954a0dd952d91
5
5
  SHA512:
6
- metadata.gz: f3792d01a260e9dcada0ddc7df7aaebbfc1280025781f4c8f2640eaba3abd0d777982f31b794cd7e37b1ce9430bd1f2a60d73dc05ddb8fc0eedd778d9574f1c6
7
- data.tar.gz: 0743bccc0a8da98dd91d697ab1b05e95fae2853fd24e8d6db6887ec7ad636de2ae970ff65e15d491388402c702d71adc2190b987a30e5ee2f30a39daf5014954
6
+ metadata.gz: fc3971541568e34c0ef644c250243fefcb48c778b2471f81f5e87a1b59535a6f5ccc2a2c13d57f5123e0577efb80962b85f8096d3d6f70e0721df4f716d705e1
7
+ data.tar.gz: 5fe74aa6d8179e6dd3d9c69a6d0c81f284035bd82343543132f129be7bfb3355e01678eddbd051d9d4c360e9704f8a234737096e757f710b395b5d366f57936f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
- ## 3.17.0
2
- - Added support for custom headers [#190](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/190)
1
+ ## 4.0.0
2
+ - SSL settings that were marked deprecated in version `3.15.0` are now marked obsolete, and will prevent the plugin from starting.
3
+ - These settings are:
4
+ - `ca_file`, which should be replaced by `ssl_certificate_authorities`
5
+ - `keystore`, which should be replaced by `ssl_keystore_path`
6
+ - `keystore_password`, which should be replaced by `ssl_keystore_password`
7
+ - `keystore_type`, which should be replaced by `ssl_keystore_password`
8
+ - `ssl`, which should be replaced by `ssl_enabled`
9
+ - [#183](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/183)
3
10
 
4
11
  ## 3.16.2
5
12
  - Add `x-elastic-product-origin` header to Elasticsearch requests [#185](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/185)
data/docs/index.asciidoc CHANGED
@@ -110,7 +110,7 @@ Authentication to a secure Elasticsearch cluster is possible using _one_ of the
110
110
  * <<plugins-{type}s-{plugin}-user>> AND <<plugins-{type}s-{plugin}-password>>
111
111
  * <<plugins-{type}s-{plugin}-cloud_auth>>
112
112
  * <<plugins-{type}s-{plugin}-api_key>>
113
- * <<plugins-{type}s-{plugin}-keystore>> and/or <<plugins-{type}s-{plugin}-keystore_password>>
113
+ * <<plugins-{type}s-{plugin}-ssl_keystore_path>> and/or <<plugins-{type}s-{plugin}-ssl_keystore_password>>
114
114
 
115
115
  [id="plugins-{type}s-{plugin}-autz"]
116
116
  ==== Authorization
@@ -121,7 +121,10 @@ The `monitoring` permission at cluster level is necessary to perform periodic co
121
121
  [id="plugins-{type}s-{plugin}-options"]
122
122
  ==== Elasticsearch Filter Configuration Options
123
123
 
124
- 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.
124
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
125
+
126
+ NOTE: As of version `4.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed. Please see the
127
+ <<plugins-{type}s-{plugin}-obsolete-options>> for more details.
125
128
 
126
129
  [cols="<,<,<",options="header",]
127
130
  |=======================================================================
@@ -131,7 +134,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
131
134
  | <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
132
135
  | <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
133
136
  | <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
134
- | <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
135
137
  | <<plugins-{type}s-{plugin}-docinfo_fields>> |<<hash,hash>>|No
136
138
  | <<plugins-{type}s-{plugin}-enable_sort>> |<<boolean,boolean>>|No
137
139
  | <<plugins-{type}s-{plugin}-fields>> |<<array,array>>|No
@@ -145,7 +147,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
145
147
  | <<plugins-{type}s-{plugin}-retry_on_failure>> |<<number,number>>|No
146
148
  | <<plugins-{type}s-{plugin}-retry_on_status>> |<<array,array>>|No
147
149
  | <<plugins-{type}s-{plugin}-sort>> |<<string,string>>|No
148
- | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|__Deprecated__
149
150
  | <<plugins-{type}s-{plugin}-ssl_certificate>> |<<path,path>>|No
150
151
  | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |list of <<path,path>>|No
151
152
  | <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |list of <<string,string>>|No
@@ -229,16 +230,6 @@ Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
229
230
  For more info, check out the
230
231
  {logstash-ref}/connecting-to-cloud.html[Logstash-to-Cloud documentation].
231
232
 
232
-
233
- [id="plugins-{type}s-{plugin}-custom_headers"]
234
- ===== `custom_headers`
235
-
236
- * Value type is <<hash,hash>>
237
- * Default value is empty
238
-
239
- Pass a set of key value pairs as the headers sent in each request to Elasticsearch.
240
- These custom headers will override any headers previously set by the plugin such as the User Agent or Authorization headers.
241
-
242
233
  [id="plugins-{type}s-{plugin}-docinfo_fields"]
243
234
  ===== `docinfo_fields`
244
235
 
@@ -530,57 +521,21 @@ Tags the event on failure to look up previous log event information. This can be
530
521
  Basic Auth - username
531
522
 
532
523
 
533
- [id="plugins-{type}s-{plugin}-deprecated-options"]
534
- ==== Elasticsearch Filter Deprecated Configuration Options
524
+ [id="plugins-{type}s-{plugin}-obsolete-options"]
525
+ ==== Elasticsearch Filter Obsolete Configuration Options
535
526
 
536
- This plugin supports the following deprecated configurations.
537
-
538
- WARNING: Deprecated options are subject to removal in future releases.
527
+ WARNING: As of version `4.0.0` of this plugin, some configuration options have been replaced.
528
+ The plugin will fail to start if it contains any of these obsolete options.
539
529
 
540
530
  [cols="<,<,<",options="header",]
541
531
  |=======================================================================
542
- |Setting|Input type|Replaced by
543
- | <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
544
- | <<plugins-{type}s-{plugin}-keystore>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_keystore_path>>
545
- | <<plugins-{type}s-{plugin}-keystore_password>> |<<password,password>>|<<plugins-{type}s-{plugin}-ssl_keystore_password>>
532
+ |Setting|Replaced by
533
+ | ca_file |<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
534
+ | keystore |<<plugins-{type}s-{plugin}-ssl_keystore_path>>
535
+ | keystore_password |<<plugins-{type}s-{plugin}-ssl_keystore_password>>
536
+ | ssl |<<plugins-{type}s-{plugin}-ssl_enabled>>
546
537
  |=======================================================================
547
538
 
548
- [id="plugins-{type}s-{plugin}-ca_file"]
549
- ===== `ca_file`
550
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
551
-
552
- * Value type is <<path,path>>
553
- * There is no default value for this setting.
554
-
555
- SSL Certificate Authority file
556
-
557
- [id="plugins-{type}s-{plugin}-ssl"]
558
- ===== `ssl`
559
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
560
-
561
- * Value type is <<boolean,boolean>>
562
- * Default value is `false`
563
-
564
- SSL
565
-
566
- [id="plugins-{type}s-{plugin}-keystore"]
567
- ===== `keystore`
568
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_path>>]
569
-
570
- * Value type is <<path,path>>
571
- * There is no default value for this setting.
572
-
573
- The keystore used to present a certificate to the server. It can be either .jks or .p12
574
-
575
- [id="plugins-{type}s-{plugin}-keystore_password"]
576
- ===== `keystore_password`
577
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_password>>]
578
-
579
- * Value type is <<password,password>>
580
- * There is no default value for this setting.
581
-
582
- Set the keystore password
583
-
584
539
 
585
540
  [id="plugins-{type}s-{plugin}-common-options"]
586
541
  include::{include_path}/{type}.asciidoc[]
@@ -20,8 +20,6 @@ module LogStash
20
20
  api_key = options.fetch(:api_key, nil)
21
21
  proxy = options.fetch(:proxy, nil)
22
22
  user_agent = options[:user_agent]
23
- custom_headers = options[:custom_headers]
24
-
25
23
 
26
24
  transport_options = { }
27
25
  transport_options[:headers] = options.fetch(:serverless, false) ? DEFAULT_EAV_HEADER.dup : {}
@@ -29,7 +27,6 @@ module LogStash
29
27
  transport_options[:headers].merge!(setup_api_key(api_key))
30
28
  transport_options[:headers].merge!({ 'user-agent' => "#{user_agent}" })
31
29
  transport_options[:headers].merge!(INTERNAL_ORIGIN_HEADER)
32
- transport_options[:headers].merge!(custom_headers) unless custom_headers.empty?
33
30
 
34
31
  transport_options[:pool_max] = 1000
35
32
  transport_options[:pool_max_per_route] = 100
@@ -3,7 +3,6 @@ require "logstash/filters/base"
3
3
  require "logstash/namespace"
4
4
  require "logstash/json"
5
5
  require 'logstash/plugin_mixins/ca_trusted_fingerprint_support'
6
- require "logstash/plugin_mixins/normalize_config_support"
7
6
  require "monitor"
8
7
 
9
8
  require_relative "elasticsearch/client"
@@ -33,9 +32,6 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
33
32
  # Array of fields to copy from old event (found via elasticsearch) into new event
34
33
  config :fields, :validate => :array, :default => {}
35
34
 
36
- # Custom headers for Elasticsearch requests
37
- config :custom_headers, :validate => :hash, :default => {}
38
-
39
35
  # Hash of docinfo fields to copy from old event (found via elasticsearch) into new event
40
36
  config :docinfo_fields, :validate => :hash, :default => {}
41
37
 
@@ -65,18 +61,6 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
65
61
  # Set the address of a forward HTTP proxy.
66
62
  config :proxy, :validate => :uri_or_empty
67
63
 
68
- # SSL
69
- config :ssl, :validate => :boolean, :default => false, :deprecated => "Set 'ssl_enabled' instead."
70
-
71
- # SSL Certificate Authority file
72
- config :ca_file, :validate => :path, :deprecated => "Set 'ssl_certificate_authorities' instead."
73
-
74
- # The keystore used to present a certificate to the server.
75
- # It can be either .jks or .p12
76
- config :keystore, :validate => :path, :deprecated => "Use 'ssl_keystore_path' instead."
77
-
78
- # Set the keystore password
79
- config :keystore_password, :validate => :password, :deprecated => "Use 'ssl_keystore_password' instead."
80
64
 
81
65
  # OpenSSL-style X.509 certificate certificate to authenticate the client
82
66
  config :ssl_certificate, :validate => :path
@@ -138,11 +122,15 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
138
122
  # What status codes to retry on?
139
123
  config :retry_on_status, :validate => :number, :list => true, :default => [500, 502, 503, 504]
140
124
 
125
+
126
+ config :ssl, :obsolete => "Set 'ssl_enabled' instead."
127
+ config :ca_file, :obsolete => "Set 'ssl_certificate_authorities' instead."
128
+ config :keystore, :obsolete => "Set 'ssl_keystore_path' instead."
129
+ config :keystore_password, :validate => :password, :obsolete => "Set 'ssl_keystore_password' instead."
130
+
141
131
  # config :ca_trusted_fingerprint, :validate => :sha_256_hex
142
132
  include LogStash::PluginMixins::CATrustedFingerprintSupport
143
133
 
144
- include LogStash::PluginMixins::NormalizeConfigSupport
145
-
146
134
  include MonitorMixin
147
135
  attr_reader :shared_client
148
136
 
@@ -272,8 +260,7 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
272
260
  :ssl => client_ssl_options,
273
261
  :retry_on_failure => @retry_on_failure,
274
262
  :retry_on_status => @retry_on_status,
275
- :user_agent => prepare_user_agent,
276
- :custom_headers => @custom_headers
263
+ :user_agent => prepare_user_agent
277
264
  }
278
265
  end
279
266
 
@@ -492,46 +479,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
492
479
  end
493
480
 
494
481
  def setup_ssl_params!
495
- @ssl_enabled = normalize_config(:ssl_enabled) do |normalize|
496
- normalize.with_deprecated_alias(:ssl)
497
- end
498
-
499
- # Infer the value if neither the deprecate `ssl` and `ssl_enabled` were set
500
- infer_ssl_enabled_from_hosts
501
-
502
- @ssl_keystore_path = normalize_config(:ssl_keystore_path) do |normalize|
503
- normalize.with_deprecated_alias(:keystore)
504
- end
505
-
506
- @ssl_keystore_password = normalize_config(:ssl_keystore_password) do |normalize|
507
- normalize.with_deprecated_alias(:keystore_password)
508
- end
509
-
510
- @ssl_certificate_authorities = normalize_config(:ssl_certificate_authorities) do |normalize|
511
- normalize.with_deprecated_mapping(:ca_file) do |ca_file|
512
- [ca_file]
513
- end
514
- end
515
-
516
- params['ssl_enabled'] = @ssl_enabled
517
- params['ssl_keystore_path'] = @ssl_keystore_path unless @ssl_keystore_path.nil?
518
- params['ssl_keystore_password'] = @ssl_keystore_password unless @ssl_keystore_password.nil?
519
- params['ssl_certificate_authorities'] = @ssl_certificate_authorities unless @ssl_certificate_authorities.nil?
520
- end
521
-
522
- def infer_ssl_enabled_from_hosts
523
- return if original_params.include?('ssl') || original_params.include?('ssl_enabled')
524
-
525
- @ssl_enabled = params['ssl_enabled'] = effectively_ssl?
526
- end
527
-
528
- def effectively_ssl?
529
- return true if @ssl_enabled
530
-
531
- hosts = Array(@hosts)
532
- return false if hosts.nil? || hosts.empty?
533
-
534
- hosts.all? { |host| host && host.to_s.start_with?("https") }
482
+ # Infer the value if neither `ssl_enabled` was not set
483
+ return if original_params.include?('ssl_enabled')
484
+ params['ssl_enabled'] = @ssl_enabled ||= Array(@hosts).all? { |host| host && host.to_s.start_with?("https") }
535
485
  end
536
486
 
537
487
  end #class LogStash::Filters::Elasticsearch
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-elasticsearch'
4
- s.version = '3.17.0'
4
+ s.version = '4.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Copies fields from previous log events in Elasticsearch to current events "
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 = "https://elastic.co/logstash"
10
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'elasticsearch', ">= 7.14.9" # LS >= 6.7 and < 7.14 all used version 5.0.5
25
25
  s.add_runtime_dependency 'manticore', ">= 0.7.1"
26
26
  s.add_runtime_dependency 'logstash-mixin-ca_trusted_fingerprint_support', '~> 1.0'
27
- s.add_runtime_dependency 'logstash-mixin-normalize_config_support', '~>1.0'
28
27
  s.add_development_dependency 'cabin', ['~> 0.6']
29
28
  s.add_development_dependency 'webrick'
30
29
  s.add_development_dependency 'logstash-devutils'
@@ -333,30 +333,6 @@ describe LogStash::Filters::Elasticsearch do
333
333
  end
334
334
  end
335
335
 
336
- context "with custom headers" do
337
- let(:config) do
338
- {
339
- "query" => "*",
340
- "custom_headers" => { "Custom-Header-1" => "Custom Value 1", "Custom-Header-2" => "Custom Value 2" }
341
- }
342
- end
343
-
344
- let(:plugin) { LogStash::Filters::Elasticsearch.new(config) }
345
- let(:client_double) { double("client") }
346
- let(:transport_double) { double("transport", options: { transport_options: { headers: config["custom_headers"] } }) }
347
-
348
- before do
349
- allow(plugin).to receive(:get_client).and_return(client_double)
350
- allow(client_double).to receive(:client).and_return(transport_double)
351
- end
352
-
353
- it "sets custom headers" do
354
- plugin.register
355
- client = plugin.send(:get_client).client
356
- expect(client.options[:transport_options][:headers]).to match(hash_including(config["custom_headers"]))
357
- end
358
- end
359
-
360
336
  context "if query is on nested field" do
361
337
  let(:config) do
362
338
  {
@@ -24,6 +24,23 @@ describe "SSL options" do
24
24
  subject.close
25
25
  end
26
26
 
27
+ describe "obsolete settings" do
28
+ [{:name => 'ca_file', :canonical_name => 'ssl_certificate_authorities'},
29
+ {:name => "keystore", :canonical_name => 'ssl_keystore_path'},
30
+ {:name => "keystore_password", :canonical_name => "ssl_keystore_password"},
31
+ {:name => "ssl", :canonical_name => "ssl_enabled"}
32
+ ].each do |config_settings|
33
+ context "with option #{config_settings[:name]}" do
34
+ let(:obsolete_config) { settings.merge(config_settings[:name] => 'test_value') }
35
+ it "emits an error about the setting `#{config_settings[:name]}` now being obsolete and provides guidance to use `#{config_settings[:canonical_name]}`" do
36
+ error_text = /The setting `#{config_settings[:name]}` in plugin `elasticsearch` is obsolete and is no longer available. Set '#{config_settings[:canonical_name]}' instead/i
37
+ expect { LogStash::Filters::Elasticsearch.new(obsolete_config) }.to raise_error LogStash::ConfigurationError, error_text
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+
27
44
  context "when ssl_enabled is" do
28
45
  context "true and there is no https hosts" do
29
46
  let(:hosts) { %w[http://es01 http://es01] }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.0
4
+ version: 4.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-29 00:00:00.000000000 Z
11
+ date: 2025-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -72,20 +72,6 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.0'
75
- - !ruby/object:Gem::Dependency
76
- requirement: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '1.0'
81
- name: logstash-mixin-normalize_config_support
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '1.0'
89
75
  - !ruby/object:Gem::Dependency
90
76
  requirement: !ruby/object:Gem::Requirement
91
77
  requirements:
@@ -174,7 +160,7 @@ files:
174
160
  - spec/filters/fixtures/test_certs/ls.der.sha256
175
161
  - spec/filters/fixtures/test_certs/ls.key
176
162
  - spec/filters/integration/elasticsearch_spec.rb
177
- homepage: https://elastic.co/logstash
163
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
178
164
  licenses:
179
165
  - Apache License (2.0)
180
166
  metadata: