logstash-output-elasticsearch 10.3.0-java → 10.3.1-java

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: 95ca05594f4d76e1bb341f14088bcafab677339c4322db449c24022d320d22ee
4
- data.tar.gz: 79ec3c6d83999b68f9ebfca2c144c5556badfb9046d1f5c968628319623001d4
3
+ metadata.gz: 0662d42a8fcb66fa69d4c9b348aef3595d9c8297ea5d37391cab2962452ba06a
4
+ data.tar.gz: 1fbbecbd7b70f22f3c8091402fc4335749b85d5431ead3b6d9ba2a4a5b12b1c7
5
5
  SHA512:
6
- metadata.gz: '049db8893d70c206be9cfe8e3e93354c98bfbd50d0718b936db79f6e9a07a3927fcdacc352f6e0eec02c0ac22ebd5cc866cd8193efa18a93a9c87f1a40251e7e'
7
- data.tar.gz: 6509ec1cc74743832955ed52ecd868546f64712d99f6984285390b41adb71dd09d179d3e180decf9596e587f1b374cf611d0bda33e1e93b8421625d439fd8ae1
6
+ metadata.gz: 929bf1d422d99ab11ac84c2a63e70de5e211ecdee64036c3c07844cc4b06c61aa22c2e49661c5521db2ee2ce6e8d069d03acfa9a17ff2be196a835a377455074
7
+ data.tar.gz: f077cb0d83d87b179a226bb9700b837e578adefa2efda988e8aa92225cf531ac2de2c021caeb7f4951e645418bd6646696ba7c54ff9eef9d73720497fd6d1f85
@@ -1,3 +1,6 @@
1
+ ## 10.3.1
2
+ - Fix: handle proxy => '' as if none was set [#912](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/912)
3
+
1
4
  ## 10.3.0
2
5
  - Feat: Added support for cloud_id and cloud_auth [#906](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/906)
3
6
 
@@ -626,6 +626,8 @@ which is bad.
626
626
  Set the address of a forward HTTP proxy.
627
627
  This used to accept hashes as arguments but now only accepts
628
628
  arguments of the URI type to prevent leaking credentials.
629
+ An empty string is treated as if proxy was not set, this is useful when using
630
+ environment variables e.g. `proxy => '${LS_PROXY:}'`.
629
631
 
630
632
  [id="plugins-{type}s-{plugin}-resurrect_delay"]
631
633
  ===== `resurrect_delay`
@@ -188,7 +188,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
188
188
  # Set the address of a forward HTTP proxy.
189
189
  # This used to accept hashes as arguments but now only accepts
190
190
  # arguments of the URI type to prevent leaking credentials.
191
- config :proxy, :validate => :uri
191
+ config :proxy, :validate => :uri # but empty string is allowed
192
192
 
193
193
  # Set the timeout, in seconds, for network operations and requests sent Elasticsearch. If
194
194
  # a timeout occurs, the request will be retried.
@@ -238,13 +238,32 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
238
238
  # Custom Headers to send on each request to elasticsearch nodes
239
239
  config :custom_headers, :validate => :hash, :default => {}
240
240
 
241
+ # @override to handle proxy => '' as if none was set
242
+ def config_init(params)
243
+ proxy = params['proxy']
244
+ if proxy.is_a?(String)
245
+ # environment variables references aren't yet resolved
246
+ proxy = deep_replace(proxy)
247
+ if proxy.empty?
248
+ params.delete('proxy')
249
+ @proxy = ''
250
+ else
251
+ params['proxy'] = proxy # do not do resolving again
252
+ end
253
+ end
254
+ super(params)
255
+ end
256
+
241
257
  def build_client
242
258
  params["metric"] = metric
259
+ if @proxy.eql?('')
260
+ @logger.warn "Supplied proxy setting (proxy => '') has no effect"
261
+ end
243
262
  @client ||= ::LogStash::Outputs::ElasticSearch::HttpClientBuilder.build(@logger, @hosts, params)
244
263
  end
245
264
 
246
265
  def close
247
- @stopping.make_true
266
+ @stopping.make_true if @stopping
248
267
  stop_template_installer
249
268
  @client.close if @client
250
269
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '10.3.0'
3
+ s.version = '10.3.1'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Stores logs in Elasticsearch"
6
6
  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"
@@ -69,4 +69,36 @@ describe "Proxy option" do
69
69
  end
70
70
  end
71
71
  end
72
+
73
+ context "when specified as ''" do
74
+ let(:settings) { super.merge("proxy" => "${A_MISSING_ENV_VARIABLE:}")}
75
+
76
+ it "should not send the proxy option to manticore" do
77
+ expect { subject.register }.not_to raise_error
78
+
79
+ expect(::Manticore::Client).to have_received(:new) do |options|
80
+ expect(options).not_to include(:proxy)
81
+ end
82
+
83
+ subject.close
84
+ end
85
+ end
86
+
87
+ context "when specified as invalid uri" do
88
+ let(:settings) { super.merge("proxy" => ":")}
89
+
90
+ it "should fail" do
91
+ # SafeURI isn't doing the proper exception wrapping for us, we can not simply :
92
+ # expect { subject.register }.to raise_error(ArgumentError, /URI is not valid/i)
93
+ begin
94
+ subject.register
95
+ rescue ArgumentError => e
96
+ expect(e.message).to match /URI is not valid/i
97
+ rescue java.net.URISyntaxException => e
98
+ expect(e.message).to match /scheme name/i
99
+ else
100
+ fail 'exception not raised'
101
+ end
102
+ end
103
+ end
72
104
  end
@@ -547,7 +547,7 @@ describe LogStash::Outputs::ElasticSearch do
547
547
  expect { subject.register }.to raise_error LogStash::ConfigurationError, /cloud_id and hosts/
548
548
  end
549
549
  end
550
- end
550
+ end if LOGSTASH_VERSION > '6.0'
551
551
 
552
552
  describe "cloud.auth" do
553
553
  let(:do_register) { false }
@@ -580,7 +580,7 @@ describe LogStash::Outputs::ElasticSearch do
580
580
  expect { subject.register }.to raise_error LogStash::ConfigurationError, /cloud_auth and user/
581
581
  end
582
582
  end
583
- end
583
+ end if LOGSTASH_VERSION > '6.0'
584
584
 
585
585
  context 'handling elasticsearch document-level status meant for the DLQ' do
586
586
  let(:options) { { "manage_template" => false } }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.3.0
4
+ version: 10.3.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-03 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement