logstash-filter-elasticsearch 3.16.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad7767b1d40fd59a496420b7e4256cdc8ce85a9dc5d438e5d495918e09f04b17
4
- data.tar.gz: f1c7c730a52abc8344416b1116eda1701d2e118e37054eec3993e6cc7da505ca
3
+ metadata.gz: 015a98dbd36122dd3fc4c74da5744a31f6182f67023f802189cc73e837d5ba7a
4
+ data.tar.gz: 8f1c3a79c0af3fc4154501d16bf775e01b6aa7575627852cb18954a0dd952d91
5
5
  SHA512:
6
- metadata.gz: 54b78fa510472eee856712d95e07e0d8ef599bc3376477aa37fbc2d6be0628e51d0fe64de43611ad398c24274fc91fb134c5fd7dd6f239bfdac32d23034657c7
7
- data.tar.gz: 4e35f51081661f012577c72e35bc516f44a92608f49a60c01963e947b28324c4ce85612513848fdecd70260aa8f50000651fc560b524452814d0fd7785c0cd4c
6
+ metadata.gz: fc3971541568e34c0ef644c250243fefcb48c778b2471f81f5e87a1b59535a6f5ccc2a2c13d57f5123e0577efb80962b85f8096d3d6f70e0721df4f716d705e1
7
+ data.tar.gz: 5fe74aa6d8179e6dd3d9c69a6d0c81f284035bd82343543132f129be7bfb3355e01678eddbd051d9d4c360e9704f8a234737096e757f710b395b5d366f57936f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
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)
10
+
11
+ ## 3.16.2
12
+ - Add `x-elastic-product-origin` header to Elasticsearch requests [#185](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/185)
13
+
1
14
  ## 3.16.1
2
15
  - Version bump to pick up doc fix in [#172](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/172)
3
16
 
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
  |=======================================================================
@@ -144,7 +147,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
144
147
  | <<plugins-{type}s-{plugin}-retry_on_failure>> |<<number,number>>|No
145
148
  | <<plugins-{type}s-{plugin}-retry_on_status>> |<<array,array>>|No
146
149
  | <<plugins-{type}s-{plugin}-sort>> |<<string,string>>|No
147
- | <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|__Deprecated__
148
150
  | <<plugins-{type}s-{plugin}-ssl_certificate>> |<<path,path>>|No
149
151
  | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |list of <<path,path>>|No
150
152
  | <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |list of <<string,string>>|No
@@ -519,57 +521,21 @@ Tags the event on failure to look up previous log event information. This can be
519
521
  Basic Auth - username
520
522
 
521
523
 
522
- [id="plugins-{type}s-{plugin}-deprecated-options"]
523
- ==== Elasticsearch Filter Deprecated Configuration Options
524
-
525
- This plugin supports the following deprecated configurations.
524
+ [id="plugins-{type}s-{plugin}-obsolete-options"]
525
+ ==== Elasticsearch Filter Obsolete Configuration Options
526
526
 
527
- 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.
528
529
 
529
530
  [cols="<,<,<",options="header",]
530
531
  |=======================================================================
531
- |Setting|Input type|Replaced by
532
- | <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
533
- | <<plugins-{type}s-{plugin}-keystore>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_keystore_path>>
534
- | <<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>>
535
537
  |=======================================================================
536
538
 
537
- [id="plugins-{type}s-{plugin}-ca_file"]
538
- ===== `ca_file`
539
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
540
-
541
- * Value type is <<path,path>>
542
- * There is no default value for this setting.
543
-
544
- SSL Certificate Authority file
545
-
546
- [id="plugins-{type}s-{plugin}-ssl"]
547
- ===== `ssl`
548
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
549
-
550
- * Value type is <<boolean,boolean>>
551
- * Default value is `false`
552
-
553
- SSL
554
-
555
- [id="plugins-{type}s-{plugin}-keystore"]
556
- ===== `keystore`
557
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_path>>]
558
-
559
- * Value type is <<path,path>>
560
- * There is no default value for this setting.
561
-
562
- The keystore used to present a certificate to the server. It can be either .jks or .p12
563
-
564
- [id="plugins-{type}s-{plugin}-keystore_password"]
565
- ===== `keystore_password`
566
- deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_password>>]
567
-
568
- * Value type is <<password,password>>
569
- * There is no default value for this setting.
570
-
571
- Set the keystore password
572
-
573
539
 
574
540
  [id="plugins-{type}s-{plugin}-common-options"]
575
541
  include::{include_path}/{type}.asciidoc[]
@@ -12,6 +12,7 @@ module LogStash
12
12
 
13
13
  BUILD_FLAVOR_SERVERLESS = 'serverless'.freeze
14
14
  DEFAULT_EAV_HEADER = { "Elastic-Api-Version" => "2023-10-31" }.freeze
15
+ INTERNAL_ORIGIN_HEADER = { 'x-elastic-product-origin' => 'logstash-filter-elasticsearch'}.freeze
15
16
 
16
17
  def initialize(logger, hosts, options = {})
17
18
  user = options.fetch(:user, nil)
@@ -25,6 +26,7 @@ module LogStash
25
26
  transport_options[:headers].merge!(setup_basic_auth(user, password))
26
27
  transport_options[:headers].merge!(setup_api_key(api_key))
27
28
  transport_options[:headers].merge!({ 'user-agent' => "#{user_agent}" })
29
+ transport_options[:headers].merge!(INTERNAL_ORIGIN_HEADER)
28
30
 
29
31
  transport_options[:pool_max] = 1000
30
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"
@@ -62,18 +61,6 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
62
61
  # Set the address of a forward HTTP proxy.
63
62
  config :proxy, :validate => :uri_or_empty
64
63
 
65
- # SSL
66
- config :ssl, :validate => :boolean, :default => false, :deprecated => "Set 'ssl_enabled' instead."
67
-
68
- # SSL Certificate Authority file
69
- config :ca_file, :validate => :path, :deprecated => "Set 'ssl_certificate_authorities' instead."
70
-
71
- # The keystore used to present a certificate to the server.
72
- # It can be either .jks or .p12
73
- config :keystore, :validate => :path, :deprecated => "Use 'ssl_keystore_path' instead."
74
-
75
- # Set the keystore password
76
- config :keystore_password, :validate => :password, :deprecated => "Use 'ssl_keystore_password' instead."
77
64
 
78
65
  # OpenSSL-style X.509 certificate certificate to authenticate the client
79
66
  config :ssl_certificate, :validate => :path
@@ -135,11 +122,15 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
135
122
  # What status codes to retry on?
136
123
  config :retry_on_status, :validate => :number, :list => true, :default => [500, 502, 503, 504]
137
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
+
138
131
  # config :ca_trusted_fingerprint, :validate => :sha_256_hex
139
132
  include LogStash::PluginMixins::CATrustedFingerprintSupport
140
133
 
141
- include LogStash::PluginMixins::NormalizeConfigSupport
142
-
143
134
  include MonitorMixin
144
135
  attr_reader :shared_client
145
136
 
@@ -488,46 +479,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
488
479
  end
489
480
 
490
481
  def setup_ssl_params!
491
- @ssl_enabled = normalize_config(:ssl_enabled) do |normalize|
492
- normalize.with_deprecated_alias(:ssl)
493
- end
494
-
495
- # Infer the value if neither the deprecate `ssl` and `ssl_enabled` were set
496
- infer_ssl_enabled_from_hosts
497
-
498
- @ssl_keystore_path = normalize_config(:ssl_keystore_path) do |normalize|
499
- normalize.with_deprecated_alias(:keystore)
500
- end
501
-
502
- @ssl_keystore_password = normalize_config(:ssl_keystore_password) do |normalize|
503
- normalize.with_deprecated_alias(:keystore_password)
504
- end
505
-
506
- @ssl_certificate_authorities = normalize_config(:ssl_certificate_authorities) do |normalize|
507
- normalize.with_deprecated_mapping(:ca_file) do |ca_file|
508
- [ca_file]
509
- end
510
- end
511
-
512
- params['ssl_enabled'] = @ssl_enabled
513
- params['ssl_keystore_path'] = @ssl_keystore_path unless @ssl_keystore_path.nil?
514
- params['ssl_keystore_password'] = @ssl_keystore_password unless @ssl_keystore_password.nil?
515
- params['ssl_certificate_authorities'] = @ssl_certificate_authorities unless @ssl_certificate_authorities.nil?
516
- end
517
-
518
- def infer_ssl_enabled_from_hosts
519
- return if original_params.include?('ssl') || original_params.include?('ssl_enabled')
520
-
521
- @ssl_enabled = params['ssl_enabled'] = effectively_ssl?
522
- end
523
-
524
- def effectively_ssl?
525
- return true if @ssl_enabled
526
-
527
- hosts = Array(@hosts)
528
- return false if hosts.nil? || hosts.empty?
529
-
530
- 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") }
531
485
  end
532
486
 
533
487
  end #class LogStash::Filters::Elasticsearch
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-elasticsearch'
4
- s.version = '3.16.1'
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"
@@ -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'
@@ -644,7 +644,7 @@ describe LogStash::Filters::Elasticsearch do
644
644
  end
645
645
  end
646
646
 
647
- describe "Elastic Api Header" do
647
+ describe "Elastic Api and Product Origin Headers" do
648
648
  let(:config) { {"query" => "*"} }
649
649
  let(:plugin) { described_class.new(config) }
650
650
  let(:headers) {{'x-elastic-product' => 'Elasticsearch'}}
@@ -666,6 +666,8 @@ describe LogStash::Filters::Elasticsearch do
666
666
  plugin.register
667
667
  client = plugin.send(:get_client).client
668
668
  expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_including("Elastic-Api-Version" => "2023-10-31")
669
+ expect( extract_transport(client).options[:transport_options][:headers] )
670
+ .to match hash_including("x-elastic-product-origin" => "logstash-filter-elasticsearch")
669
671
  end
670
672
  end
671
673
 
@@ -676,10 +678,12 @@ describe LogStash::Filters::Elasticsearch do
676
678
  expect_any_instance_of(Elasticsearch::Client).to receive(:perform_request).with(any_args).and_return(mock_resp)
677
679
  end
678
680
 
679
- it 'does not propagate header to es client' do
681
+ it 'does not propagate Elastic-Api-Version header to es client' do
680
682
  plugin.register
681
683
  client = plugin.send(:get_client).client
682
684
  expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_not_including("Elastic-Api-Version" => "2023-10-31")
685
+ expect( extract_transport(client).options[:transport_options][:headers] )
686
+ .to match hash_including("x-elastic-product-origin" => "logstash-filter-elasticsearch")
683
687
  end
684
688
  end
685
689
 
@@ -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.16.1
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: 2023-09-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
@@ -20,8 +20,8 @@ dependencies:
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.99'
22
22
  name: logstash-core-plugin-api
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
@@ -37,8 +37,8 @@ dependencies:
37
37
  - !ruby/object:Gem::Version
38
38
  version: 7.14.9
39
39
  name: elasticsearch
40
- prerelease: false
41
40
  type: :runtime
41
+ prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
@@ -51,8 +51,8 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.7.1
53
53
  name: manticore
54
- prerelease: false
55
54
  type: :runtime
55
+ prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
@@ -65,22 +65,8 @@ dependencies:
65
65
  - !ruby/object:Gem::Version
66
66
  version: '1.0'
67
67
  name: logstash-mixin-ca_trusted_fingerprint_support
68
- prerelease: false
69
68
  type: :runtime
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
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
69
  prerelease: false
83
- type: :runtime
84
70
  version_requirements: !ruby/object:Gem::Requirement
85
71
  requirements:
86
72
  - - "~>"
@@ -93,8 +79,8 @@ dependencies:
93
79
  - !ruby/object:Gem::Version
94
80
  version: '0.6'
95
81
  name: cabin
96
- prerelease: false
97
82
  type: :development
83
+ prerelease: false
98
84
  version_requirements: !ruby/object:Gem::Requirement
99
85
  requirements:
100
86
  - - "~>"
@@ -107,8 +93,8 @@ dependencies:
107
93
  - !ruby/object:Gem::Version
108
94
  version: '0'
109
95
  name: webrick
110
- prerelease: false
111
96
  type: :development
97
+ prerelease: false
112
98
  version_requirements: !ruby/object:Gem::Requirement
113
99
  requirements:
114
100
  - - ">="
@@ -121,8 +107,8 @@ dependencies:
121
107
  - !ruby/object:Gem::Version
122
108
  version: '0'
123
109
  name: logstash-devutils
124
- prerelease: false
125
110
  type: :development
111
+ prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - ">="
@@ -195,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
181
  - !ruby/object:Gem::Version
196
182
  version: '0'
197
183
  requirements: []
198
- rubygems_version: 3.2.33
184
+ rubygems_version: 3.3.26
199
185
  signing_key:
200
186
  specification_version: 4
201
187
  summary: Copies fields from previous log events in Elasticsearch to current events