logstash-output-elasticsearch 6.2.5-java → 6.2.6-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
  SHA1:
3
- metadata.gz: b8d5f7fef1865846b84c49dfe25980784557041b
4
- data.tar.gz: 9eb6fee0f2c819cd0a2f6abbb989d67d5d0f0724
3
+ metadata.gz: 61e3482785093444d19b07aae664a7f4bdd9d8a8
4
+ data.tar.gz: 583f5fac5272e56c5aa7f11246d92b2fe521e352
5
5
  SHA512:
6
- metadata.gz: 53269eaa667f3e7d4c3f3ee21c1f6f33771cb7a046e00a502b7d78d44614078bcde802d104a95ea4af26128383285c0bd74e998e06c2fb40b155c578c9fb835c
7
- data.tar.gz: 2d70eaacefd1a827aa56feaccdd77c2c010512fd1b7a646bcad2078b2491f2958f262ea470a36d5370eecc34704f61718fcf8e6c76ccf76f7714e329c5aed331
6
+ metadata.gz: da95653926bd5c8a3e83b06d9cdaa8f0682018338221959e1c42d02000fea0e2bb9c7f9b3de94053a8bee6c4de1fa9354d90eba355e4f6ffdd28dfcc59901755
7
+ data.tar.gz: 75fe257a8468a539dbc54e691b8de5f71930e2646107264d664f871d7289a49d745feccc9a465d875bdea7d0786386fc041442de6fc22133662859a05bbe5b85
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.2.6
2
+ - Fixed: Change how the healthcheck_path is treated: either append it to any existing path (default) or replace any existing path
3
+ Also ensures that the healthcheck url contains no query parameters regarless of hosts urls contains them or query_params being set. #554
4
+
1
5
  ## 6.2.5
2
6
  - Send the Content-Type: application/json header that proper ES clients should send
3
7
 
@@ -173,14 +173,21 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
173
173
 
174
174
  # When a backend is marked down a HEAD request will be sent to this path in the
175
175
  # background to see if it has come back again before it is once again eligible
176
- # to service requests. If you have custom firewall rules you may need to change
177
- # this
176
+ # to service requests. If you have custom firewall rules you may need to change this
177
+ # NOTE: any query parameters present in the URL or query_params config option will be removed
178
178
  config :healthcheck_path, :validate => :string, :default => "/"
179
- # When a `healthcheck_path` config is provided, this additional flag can be used to
180
- # specify whether it is an absolute URI or a relative path.
181
- # If this flag is true, `healthcheck_path` is expected to be a fully formed URL
182
- # with any basic auth credentials provided in the URL itself.
179
+
180
+ # When a `healthcheck_path` config is provided, this additional flag can be used to
181
+ # specify whether the healthcheck_path is appended to the existing path (default)
182
+ # or is treated as the absolute URL path.
183
+ #
184
+ # For example, if hosts url is "http://localhost:9200/es" and healthcheck_path is "/health",
185
+ # the health check url will be:
186
+ #
187
+ # * with `absolute_healthcheck_path: true`: "http://localhost:9200/es/health"
188
+ # * with `absolute_healthcheck_path: false`: "http://localhost:9200/health"
183
189
  config :absolute_healthcheck_path, :validate => :boolean, :default => false
190
+
184
191
  # How frequently, in seconds, to wait between resurrection attempts.
185
192
  # Resurrection is the process by which backend endpoints marked 'down' are checked
186
193
  # to see if they have come back to life
@@ -231,10 +231,10 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
231
231
  @state_mutex.synchronize { @url_info.select {|url,meta| meta[:state] != :alive } }.each do |url,meta|
232
232
  begin
233
233
  path = healthcheck_path
234
- healthcheck_url = url
234
+ healthcheck_url = LogStash::Util::SafeURI.new(url.uri.clone)
235
+ healthcheck_url.query = nil
235
236
  if @absolute_healthcheck_path
236
- healthcheck_url = ::LogStash::Util::SafeURI.new(healthcheck_path)
237
- path = ROOT_URI_PATH
237
+ healthcheck_url.path = ROOT_URI_PATH
238
238
  end
239
239
  logger.info("Running health check to see if an Elasticsearch connection is working",
240
240
  :healthcheck_url => healthcheck_url, :path => path)
@@ -1,7 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
-
3
2
  s.name = 'logstash-output-elasticsearch'
4
- s.version = '6.2.5'
3
+ s.version = '6.2.6'
5
4
  s.licenses = ['apache-2.0']
6
5
  s.summary = "Logstash Output to Elasticsearch"
7
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"
@@ -44,22 +44,47 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
44
44
  sleep(subject.resurrect_delay + 1)
45
45
  end
46
46
 
47
- describe "absolute_healthcheck_path" do
48
- let(:options) { super.merge(:absolute_healthcheck_path => true, :healthcheck_path => "http://abc:xyz@localhost:9200")}
49
- let(:pool) { described_class.new(logger, adapter, initial_urls, options) }
50
-
51
- before do
52
- pool.start
47
+ describe "healthcheck url handling" do
48
+ let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200#{path}")] }
49
+ let(:healthcheck_path) { "/some/other/path" }
50
+ let(:absolute_healthcheck_path) { false }
51
+ let(:path) { "/meh" }
52
+ let(:options) { super.merge(:absolute_healthcheck_path => absolute_healthcheck_path, :path => path, :healthcheck_path => healthcheck_path) }
53
+
54
+ context "when using query params in the initial url" do
55
+ let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200?q=s")] }
56
+ it "is removed from the healthcheck request" do
57
+ expect(adapter).to receive(:perform_request) do |url, method, req_path, _, _|
58
+ expect(method).to eq(:head)
59
+ expect(url.query).to be_nil
60
+ end
61
+ subject.healthcheck!
62
+ end
53
63
  end
54
64
 
55
- after do
56
- pool.close
57
- end
65
+ describe "absolute_healthcheck_path" do
66
+ context "when enabled" do
67
+ let(:absolute_healthcheck_path) { true }
68
+ it "should use the healthcheck_path as the absolute path" do
69
+ expect(adapter).to receive(:perform_request) do |url, method, req_path, _, _|
70
+ expect(method).to eq(:head)
71
+ expect(req_path).to eq(healthcheck_path)
72
+ expect(url.path).to eq("/")
73
+ end
74
+ subject.healthcheck!
75
+ end
76
+ end
58
77
 
59
- context "when enabled" do
60
- it "should use the healthcheck_path as URL to do a health check" do
61
- expect(adapter).to receive(:perform_request).with(::LogStash::Util::SafeURI.new(subject.healthcheck_path), :head, "/", {}, nil)
62
- pool.healthcheck!
78
+ context "when disabled" do
79
+ let(:absolute_healthcheck_path) { false }
80
+ it "should use the healthcheck_path as a relative path" do
81
+ expect(adapter).to receive(:perform_request) do |url, method, req_path, _, _|
82
+ expect(method).to eq(:head)
83
+ expect(req_path).to eq(healthcheck_path)
84
+ expect(url.path).to eq(path)
85
+ end
86
+ subject.healthcheck!
87
+ end
63
88
  end
64
89
  end
65
90
  end
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: 6.2.5
4
+ version: 6.2.6
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement