logstash-output-elasticsearch 6.3.0-java → 7.0.0-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: c643a65352466edd12cc72fd46dc55cb55b31abe
4
- data.tar.gz: 4ee86089fd0a20e3ca27ff3434faa31408ed941d
3
+ metadata.gz: 76021c7104485b80a897db193e8bcb698bcb3e88
4
+ data.tar.gz: f4f3bcec4e2f448a1f424b53c03c6c96ca46f5dc
5
5
  SHA512:
6
- metadata.gz: e3c9c26a775b61f24da553bed01dba155bdca35fea9513d13f5ca818ba49f49d2ce779ed53542d20ae3c6aa40814ccb6a1f82b583ff41b65338296d3bd9ec631
7
- data.tar.gz: 5ab4e49ff1fd3b35d739c4e5e44c4a0e36ffd8ebe563fa9e235b03936e5015fc571171b97c9a610c6d3a7f4e696761ee829114f09d30bada34ffa90dc74eb3dd
6
+ metadata.gz: d1e75e1711a6e2f376d1e69e2bceeb029a617e96195841dd1673a4bf4d151223336816a967fde9a9be6d71edacd2f727f60f0f50162ce48dba17b2fbdf01f770
7
+ data.tar.gz: 53ace3cb794f69182d6eae22c3041879a587b682a5fb9939c76d4a64f5e5e042928943edcd08966496250903dc1f78f997bddb0f8a80bb676e7d97c7c7f76387
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
- ## 6.3.0
2
- - Add support for customizing sniffing_path with absolute_sniffing_path
1
+ ## 7.0.0
2
+ - introduce customization of bulk, healthcheck and sniffing paths with the behaviour:
3
+ - if not set: the default value will be used
4
+ - if not set and path is also set: the default is appended to path
5
+ - if set: the set value will be used, ignoring the default and path setting
6
+ - removes absolute_healthcheck_path and query_parameters
3
7
 
4
8
  ## 6.2.6
5
9
  - Fixed: Change how the healthcheck_path is treated: either append it to any existing path (default) or replace any existing path
@@ -103,6 +103,10 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
103
103
  # not also set this field. That will raise an error at startup
104
104
  config :path, :validate => :string
105
105
 
106
+ # HTTP Path to perform the _bulk requests to
107
+ # this defaults to a concatenation of the path parameter and "_bulk"
108
+ config :bulk_path, :validate => :string
109
+
106
110
  # Pass a set of key value pairs as the URL query string. This query string is added
107
111
  # to every host listed in the 'hosts' configuration. If the 'hosts' list contains
108
112
  # urls that already have query strings, the one specified here will be appended.
@@ -145,6 +149,12 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
145
149
  # How long to wait, in seconds, between sniffing attempts
146
150
  config :sniffing_delay, :validate => :number, :default => 5
147
151
 
152
+ # HTTP Path to be used for the sniffing requests
153
+ # the default value is computed by concatenating the path value and "_nodes/http"
154
+ # if sniffing_path is set it will be used as an absolute path
155
+ # do not use full URL here, only paths, e.g. "/sniff/_nodes/http"
156
+ config :sniffing_path, :validate => :string
157
+
148
158
  # Set the address of a forward HTTP proxy.
149
159
  # This used to accept hashes as arguments but now only accepts
150
160
  # arguments of the URI type to prevent leaking credentials.
@@ -171,40 +181,11 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
171
181
  # which is bad.
172
182
  config :pool_max_per_route, :validate => :number, :default => 100
173
183
 
174
- # When a backend is marked down a HEAD request will be sent to this path in the
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 this
177
- # NOTE: any query parameters present in the URL or query_params config option will be removed
178
- config :healthcheck_path, :validate => :string, :default => "/"
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"
189
- config :absolute_healthcheck_path, :validate => :boolean, :default => false
190
-
191
- # If sniffing is enabled, this plugin will periodically execute a request
192
- # to one of the nodes to retrieve the list of other nodes eligible to receive
193
- # bulk requests. By default this path is `_nodes/http` but if you need to set
194
- # it to something else, this is the place
195
- # NOTE: any query parameters present in the URL or query_params config option will be removed
196
- config :sniffing_path, :validate => :string, :default => "_nodes/http"
197
-
198
- # When a `sniffing_path` config is provided, this additional flag can be used to
199
- # specify whether this sniffing_path is appended to the existing path (default)
200
- # or is treated as the absolute URL path.
201
- #
202
- # For example, if hosts url is "http://localhost:9200/es" and sniffing_path is "/_sniffing",
203
- # the sniffing request will be sent to:
204
- #
205
- # * with `absolute_sniffing_path: true`: "http://localhost:9200/es/_sniffing"
206
- # * with `absolute_sniffing_path: false`: "http://localhost:9200/_sniffing"
207
- config :absolute_sniffing_path, :validate => :boolean, :default => false
184
+ # HTTP Path where a HEAD request is sent when a backend is marked down
185
+ # the request is sent in the background to see if it has come back again
186
+ # before it is once again eligible to service requests.
187
+ # If you have custom firewall rules you may need to change this
188
+ config :healthcheck_path, :validate => :string
208
189
 
209
190
  # How frequently, in seconds, to wait between resurrection attempts.
210
191
  # Resurrection is the process by which backend endpoints marked 'down' are checked
@@ -58,6 +58,7 @@ module LogStash; module Outputs; class ElasticSearch;
58
58
  @pool = build_pool(@options)
59
59
  # mutex to prevent requests and sniffing to access the
60
60
  # connection pool at the same time
61
+ @bulk_path = @options[:bulk_path]
61
62
  end
62
63
 
63
64
  def build_url_template
@@ -129,8 +130,7 @@ module LogStash; module Outputs; class ElasticSearch;
129
130
  end
130
131
 
131
132
  def bulk_send(bulk_body)
132
- # Discard the URL
133
- url, response = @pool.post("_bulk", nil, bulk_body)
133
+ _, response = @pool.post(@bulk_path, nil, bulk_body)
134
134
  LogStash::Json.load(response.body)
135
135
  end
136
136
 
@@ -138,7 +138,6 @@ module LogStash; module Outputs; class ElasticSearch;
138
138
  @pool.close
139
139
  end
140
140
 
141
-
142
141
  def calculate_property(uris, property, default, sniff_check)
143
142
  values = uris.map(&property).uniq
144
143
 
@@ -249,10 +248,8 @@ module LogStash; module Outputs; class ElasticSearch;
249
248
  pool_options = {
250
249
  :sniffing => sniffing,
251
250
  :sniffer_delay => options[:sniffer_delay],
252
- :healthcheck_path => options[:healthcheck_path],
253
- :absolute_healthcheck_path => options[:absolute_healthcheck_path],
254
251
  :sniffing_path => options[:sniffing_path],
255
- :absolute_sniffing_path => options[:absolute_sniffing_path],
252
+ :healthcheck_path => options[:healthcheck_path],
256
253
  :resurrect_delay => options[:resurrect_delay],
257
254
  :url_normalizer => self.method(:host_to_url)
258
255
  }
@@ -79,7 +79,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
79
79
  resp
80
80
  end
81
81
 
82
- def format_url(url, path)
82
+ def format_url(url, path=nil)
83
83
 
84
84
  request_uri = url.uri
85
85
 
@@ -92,7 +92,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
92
92
  # and restore it after this operation
93
93
  query = request_uri.query
94
94
  request_uri = URI.join(request_uri, relative_path)
95
- request_uri.query = query
95
+ request_uri.query = query if query
96
96
  else
97
97
  request_uri = request_uri.clone
98
98
  end
@@ -28,15 +28,14 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
28
28
  end
29
29
  end
30
30
 
31
- attr_reader :logger, :adapter, :sniffing, :sniffer_delay, :resurrect_delay, :healthcheck_path, :absolute_healthcheck_path, :sniffing_path, :absolute_sniffing_path
31
+ attr_reader :logger, :adapter, :sniffing, :sniffer_delay, :resurrect_delay, :healthcheck_path, :sniffing_path, :bulk_path
32
32
 
33
33
  ROOT_URI_PATH = '/'.freeze
34
34
 
35
35
  DEFAULT_OPTIONS = {
36
36
  :healthcheck_path => ROOT_URI_PATH,
37
- :absolute_healthcheck_path => false,
38
- :sniffing_path => '_nodes/http',
39
- :absolute_sniffing_path => false,
37
+ :sniffing_path => "/_nodes/http",
38
+ :bulk_path => "/_bulk",
40
39
  :scheme => 'http',
41
40
  :resurrect_delay => 5,
42
41
  :sniffing => false,
@@ -51,10 +50,9 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
51
50
  raise ArgumentError, "No URL Normalizer specified!" unless options[:url_normalizer]
52
51
  @url_normalizer = options[:url_normalizer]
53
52
  DEFAULT_OPTIONS.merge(options).tap do |merged|
54
- @healthcheck_path = merged[:healthcheck_path]
55
- @absolute_healthcheck_path = merged[:absolute_healthcheck_path]
53
+ @bulk_path = merged[:bulk_path]
56
54
  @sniffing_path = merged[:sniffing_path]
57
- @absolute_sniffing_path = merged[:absolute_sniffing_path]
55
+ @healthcheck_path = merged[:healthcheck_path]
58
56
  @resurrect_delay = merged[:resurrect_delay]
59
57
  @sniffing = merged[:sniffing]
60
58
  @sniffer_delay = merged[:sniffer_delay]
@@ -156,17 +154,9 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
156
154
  ES2_SNIFF_RE_URL = /([^\/]*)?\/?([^:]*):([0-9]+)/
157
155
  # Sniffs and returns the results. Does not update internal URLs!
158
156
  def check_sniff
159
- resp = nil
160
- with_connection do |url|
161
- sniffing_url = url.clone
162
- sniffing_url.query = nil
163
- if @absolute_sniffing_path
164
- sniffing_url.path = ROOT_URI_PATH
165
- end
166
- resp = perform_request_to_url(sniffing_url, :get, @sniffing_path, {}, nil)
167
- end
157
+ _, resp = perform_request(:get, @sniffing_path)
168
158
  parsed = LogStash::Json.load(resp.body)
169
-
159
+
170
160
  nodes = parsed['nodes']
171
161
  if !nodes || nodes.empty?
172
162
  @logger.warn("Sniff returned no nodes! Will not update hosts.")
@@ -242,17 +232,11 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
242
232
  # Try to keep locking granularity low such that we don't affect IO...
243
233
  @state_mutex.synchronize { @url_info.select {|url,meta| meta[:state] != :alive } }.each do |url,meta|
244
234
  begin
245
- path = healthcheck_path
246
- healthcheck_url = LogStash::Util::SafeURI.new(url.uri.clone)
247
- healthcheck_url.query = nil
248
- if @absolute_healthcheck_path
249
- healthcheck_url.path = ROOT_URI_PATH
250
- end
251
235
  logger.info("Running health check to see if an Elasticsearch connection is working",
252
- :healthcheck_url => healthcheck_url, :path => path)
253
- response = perform_request_to_url(healthcheck_url, :head, path)
236
+ :healthcheck_url => url, :path => @healthcheck_path)
237
+ response = perform_request_to_url(url, :head, @healthcheck_path)
254
238
  # If no exception was raised it must have succeeded!
255
- logger.warn("Restored connection to ES instance", :url => healthcheck_url.sanitized)
239
+ logger.warn("Restored connection to ES instance", :url => url.sanitized)
256
240
  @state_mutex.synchronize { meta[:state] = :alive }
257
241
  rescue HostUnreachableError, BadResponseCodeError => e
258
242
  logger.warn("Attempted to resurrect connection to dead ES instance, but got an error.", url: url.sanitized, error_type: e.class, error: e.message)
@@ -13,11 +13,7 @@ module LogStash; module Outputs; class ElasticSearch;
13
13
 
14
14
  common_options = {
15
15
  :client_settings => client_settings,
16
- :resurrect_delay => params["resurrect_delay"],
17
- :healthcheck_path => params["healthcheck_path"],
18
- :absolute_healthcheck_path => params["absolute_healthcheck_path"],
19
- :sniffing_path => params["sniffing_path"],
20
- :absolute_sniffing_path => params["absolute_sniffing_path"]
16
+ :resurrect_delay => params["resurrect_delay"]
21
17
  }
22
18
 
23
19
  if params["sniffing"]
@@ -28,7 +24,25 @@ module LogStash; module Outputs; class ElasticSearch;
28
24
  common_options[:timeout] = params["timeout"] if params["timeout"]
29
25
 
30
26
  if params["path"]
31
- client_settings[:path] = "/#{params["path"]}/".gsub(/\/+/, "/") # Normalize slashes
27
+ client_settings[:path] = dedup_slashes("/#{params["path"]}/")
28
+ end
29
+
30
+ common_options[:bulk_path] = if params["bulk_path"]
31
+ dedup_slashes("/#{params["bulk_path"]}")
32
+ else
33
+ dedup_slashes("/#{params["path"]}/_bulk")
34
+ end
35
+
36
+ common_options[:sniffing_path] = if params["sniffing_path"]
37
+ dedup_slashes("/#{params["sniffing_path"]}")
38
+ else
39
+ dedup_slashes("/#{params["path"]}/_nodes/http")
40
+ end
41
+
42
+ common_options[:healthcheck_path] = if params["healthcheck_path"]
43
+ dedup_slashes("/#{params["healthcheck_path"]}")
44
+ else
45
+ dedup_slashes("/#{params["path"]}")
32
46
  end
33
47
 
34
48
  if params["parameters"]
@@ -79,9 +93,11 @@ module LogStash; module Outputs; class ElasticSearch;
79
93
  }
80
94
  common_options.merge! update_options if params["action"] == 'update'
81
95
 
82
- LogStash::Outputs::ElasticSearch::HttpClient.new(
83
- common_options.merge(:hosts => hosts, :logger => logger)
84
- )
96
+ create_http_client(common_options.merge(:hosts => hosts, :logger => logger))
97
+ end
98
+
99
+ def self.create_http_client(options)
100
+ LogStash::Outputs::ElasticSearch::HttpClient.new(options)
85
101
  end
86
102
 
87
103
  def self.setup_ssl(logger, params)
@@ -133,5 +149,10 @@ module LogStash; module Outputs; class ElasticSearch;
133
149
  :password => unsafe_escaped_password
134
150
  }
135
151
  end
152
+
153
+ private
154
+ def self.dedup_slashes(url)
155
+ url.gsub(/\/+/, "/")
156
+ end
136
157
  end
137
158
  end; end; end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '6.3.0'
3
+ s.version = '7.0.0'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Logstash Output to 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"
@@ -1,3 +1,4 @@
1
+ require "logstash/devutils/rspec/spec_helper"
1
2
  require "logstash/outputs/elasticsearch"
2
3
  require "logstash/outputs/elasticsearch/http_client"
3
4
  require "logstash/outputs/elasticsearch/http_client_builder"
@@ -32,4 +33,161 @@ describe LogStash::Outputs::ElasticSearch::HttpClientBuilder do
32
33
  end
33
34
  end
34
35
  end
36
+
37
+ describe "customizing action paths" do
38
+ let(:hosts) { [ ::LogStash::Util::SafeURI.new("http://localhost:9200") ] }
39
+ let(:options) { {"hosts" => hosts } }
40
+ let(:logger) { double("logger") }
41
+ before :each do
42
+ [:debug, :debug?, :info?, :info, :warn].each do |level|
43
+ allow(logger).to receive(level)
44
+ end
45
+ end
46
+
47
+ describe "healthcheck_path" do
48
+
49
+ context "when setting bulk_path" do
50
+ let(:bulk_path) { "/meh" }
51
+ let(:options) { super.merge("bulk_path" => bulk_path) }
52
+
53
+ context "when using path" do
54
+ let(:options) { super.merge("path" => "/path") }
55
+ it "ignores the path setting" do
56
+ expect(described_class).to receive(:create_http_client) do |options|
57
+ expect(options[:bulk_path]).to eq(bulk_path)
58
+ end
59
+ described_class.build(logger, hosts, options)
60
+ end
61
+ end
62
+ context "when not using path" do
63
+
64
+ it "uses the bulk_path setting" do
65
+ expect(described_class).to receive(:create_http_client) do |options|
66
+ expect(options[:bulk_path]).to eq(bulk_path)
67
+ end
68
+ described_class.build(logger, hosts, options)
69
+ end
70
+ end
71
+ end
72
+
73
+ context "when not setting bulk_path" do
74
+
75
+ context "when using path" do
76
+ let(:path) { "/meh" }
77
+ let(:options) { super.merge("path" => path) }
78
+ it "sets bulk_path to path+_bulk" do
79
+ expect(described_class).to receive(:create_http_client) do |options|
80
+ expect(options[:bulk_path]).to eq("#{path}/_bulk")
81
+ end
82
+ described_class.build(logger, hosts, options)
83
+ end
84
+ end
85
+
86
+ context "when not using path" do
87
+ it "sets the bulk_path to _bulk" do
88
+ expect(described_class).to receive(:create_http_client) do |options|
89
+ expect(options[:bulk_path]).to eq("/_bulk")
90
+ end
91
+ described_class.build(logger, hosts, options)
92
+ end
93
+ end
94
+ end
95
+ end
96
+ describe "healthcheck_path" do
97
+ context "when setting healthcheck_path" do
98
+ let(:healthcheck_path) { "/meh" }
99
+ let(:options) { super.merge("healthcheck_path" => healthcheck_path) }
100
+
101
+ context "when using path" do
102
+ let(:options) { super.merge("path" => "/path") }
103
+ it "ignores the path setting" do
104
+ expect(described_class).to receive(:create_http_client) do |options|
105
+ expect(options[:healthcheck_path]).to eq(healthcheck_path)
106
+ end
107
+ described_class.build(logger, hosts, options)
108
+ end
109
+ end
110
+ context "when not using path" do
111
+
112
+ it "uses the healthcheck_path setting" do
113
+ expect(described_class).to receive(:create_http_client) do |options|
114
+ expect(options[:healthcheck_path]).to eq(healthcheck_path)
115
+ end
116
+ described_class.build(logger, hosts, options)
117
+ end
118
+ end
119
+ end
120
+
121
+ context "when not setting healthcheck_path" do
122
+
123
+ context "when using path" do
124
+ let(:path) { "/meh" }
125
+ let(:options) { super.merge("path" => path) }
126
+ it "sets healthcheck_path to path" do
127
+ expect(described_class).to receive(:create_http_client) do |options|
128
+ expect(options[:healthcheck_path]).to eq(path)
129
+ end
130
+ described_class.build(logger, hosts, options)
131
+ end
132
+ end
133
+
134
+ context "when not using path" do
135
+ it "sets the healthcheck_path to root" do
136
+ expect(described_class).to receive(:create_http_client) do |options|
137
+ expect(options[:healthcheck_path]).to eq("/")
138
+ end
139
+ described_class.build(logger, hosts, options)
140
+ end
141
+ end
142
+ end
143
+ end
144
+ describe "sniffing_path" do
145
+ context "when setting sniffing_path" do
146
+ let(:sniffing_path) { "/meh" }
147
+ let(:options) { super.merge("sniffing_path" => sniffing_path) }
148
+
149
+ context "when using path" do
150
+ let(:options) { super.merge("path" => "/path") }
151
+ it "ignores the path setting" do
152
+ expect(described_class).to receive(:create_http_client) do |options|
153
+ expect(options[:sniffing_path]).to eq(sniffing_path)
154
+ end
155
+ described_class.build(logger, hosts, options)
156
+ end
157
+ end
158
+ context "when not using path" do
159
+
160
+ it "uses the sniffing_path setting" do
161
+ expect(described_class).to receive(:create_http_client) do |options|
162
+ expect(options[:sniffing_path]).to eq(sniffing_path)
163
+ end
164
+ described_class.build(logger, hosts, options)
165
+ end
166
+ end
167
+ end
168
+
169
+ context "when not setting sniffing_path" do
170
+
171
+ context "when using path" do
172
+ let(:path) { "/meh" }
173
+ let(:options) { super.merge("path" => path) }
174
+ it "sets sniffing_path to path+_nodes/http" do
175
+ expect(described_class).to receive(:create_http_client) do |options|
176
+ expect(options[:sniffing_path]).to eq("#{path}/_nodes/http")
177
+ end
178
+ described_class.build(logger, hosts, options)
179
+ end
180
+ end
181
+
182
+ context "when not using path" do
183
+ it "sets the sniffing_path to _nodes/http" do
184
+ expect(described_class).to receive(:create_http_client) do |options|
185
+ expect(options[:sniffing_path]).to eq("/_nodes/http")
186
+ end
187
+ described_class.build(logger, hosts, options)
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
35
193
  end
@@ -45,46 +45,29 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
45
45
  end
46
46
 
47
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
48
+ let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200")] }
49
+
50
+ context "and not setting healthcheck_path" do
51
+ it "performs the healthcheck to the root" do
57
52
  expect(adapter).to receive(:perform_request) do |url, method, req_path, _, _|
58
53
  expect(method).to eq(:head)
59
- expect(url.query).to be_nil
54
+ expect(url.path).to be_empty
55
+ expect(req_path).to eq("/")
60
56
  end
61
57
  subject.healthcheck!
62
58
  end
63
59
  end
64
60
 
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
77
-
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!
61
+ context "and setting healthcheck_path" do
62
+ let(:healthcheck_path) { "/my/health" }
63
+ let(:options) { super.merge(:healthcheck_path => healthcheck_path) }
64
+ it "performs the healthcheck to the healthcheck_path" do
65
+ expect(adapter).to receive(:perform_request) do |url, method, req_path, _, _|
66
+ expect(method).to eq(:head)
67
+ expect(url.path).to be_empty
68
+ expect(req_path).to eq(healthcheck_path)
87
69
  end
70
+ subject.healthcheck!
88
71
  end
89
72
  end
90
73
  end
@@ -102,42 +85,6 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
102
85
  expect(subject.sniffer_alive?).to eql(true)
103
86
  end
104
87
  end
105
- describe "absolute_sniffing_path" do
106
- let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200#{path}")] }
107
- let(:path) { "/meh" }
108
- let(:options) { super.merge(:absolute_sniffing_path => absolute_sniffing_path, :path => path, :sniffing_path => sniffing_path) }
109
- let(:sniffing_path) { "/some/other/path" }
110
- let(:absolute_sniffing_path) { false }
111
- let(:response) { double("manticore_response") }
112
-
113
- before(:each) { allow(response).to receive(:body).and_return("{}") }
114
-
115
- context "when enabled" do
116
- let(:absolute_sniffing_path) { true }
117
- it "should use the sniffing_path as the absolute path" do
118
- expect(subject).to receive(:perform_request_to_url) do |url, method, req_path, _, _|
119
- expect(method).to eq(:get)
120
- expect(req_path).to eq(sniffing_path)
121
- expect(url.path).to eq("/")
122
- response
123
- end
124
- subject.check_sniff
125
- end
126
- end
127
-
128
- context "when disabled" do
129
- let(:absolute_sniffing_path) { false }
130
- it "should use the sniffing_path as a relative path" do
131
- expect(subject).to receive(:perform_request_to_url) do |url, method, req_path, _, _|
132
- expect(method).to eq(:get)
133
- expect(req_path).to eq(sniffing_path)
134
- expect(url.path).to eq(path)
135
- response
136
- end
137
- subject.check_sniff
138
- end
139
- end
140
- end
141
88
  end
142
89
 
143
90
  describe "closing" do
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 7.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-12 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: stud
15
- version_requirements: !ruby/object:Gem::Requirement
14
+ requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
@@ -20,7 +19,10 @@ dependencies:
20
19
  - - "~>"
21
20
  - !ruby/object:Gem::Version
22
21
  version: '0.0'
23
- requirement: !ruby/object:Gem::Requirement
22
+ name: stud
23
+ prerelease: false
24
+ type: :runtime
25
+ version_requirements: !ruby/object:Gem::Requirement
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
@@ -28,25 +30,22 @@ dependencies:
28
30
  - - "~>"
29
31
  - !ruby/object:Gem::Version
30
32
  version: '0.0'
31
- prerelease: false
32
- type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
- name: cabin
35
- version_requirements: !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
36
  - - "~>"
38
37
  - !ruby/object:Gem::Version
39
38
  version: '0.6'
40
- requirement: !ruby/object:Gem::Requirement
39
+ name: cabin
40
+ prerelease: false
41
+ type: :runtime
42
+ version_requirements: !ruby/object:Gem::Requirement
41
43
  requirements:
42
44
  - - "~>"
43
45
  - !ruby/object:Gem::Version
44
46
  version: '0.6'
45
- prerelease: false
46
- type: :runtime
47
47
  - !ruby/object:Gem::Dependency
48
- name: logstash-core-plugin-api
49
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
50
49
  requirements:
51
50
  - - ">="
52
51
  - !ruby/object:Gem::Version
@@ -54,7 +53,10 @@ dependencies:
54
53
  - - "<="
55
54
  - !ruby/object:Gem::Version
56
55
  version: '2.99'
57
- requirement: !ruby/object:Gem::Requirement
56
+ name: logstash-core-plugin-api
57
+ prerelease: false
58
+ type: :runtime
59
+ version_requirements: !ruby/object:Gem::Requirement
58
60
  requirements:
59
61
  - - ">="
60
62
  - !ruby/object:Gem::Version
@@ -62,74 +64,63 @@ dependencies:
62
64
  - - "<="
63
65
  - !ruby/object:Gem::Version
64
66
  version: '2.99'
65
- prerelease: false
66
- type: :runtime
67
67
  - !ruby/object:Gem::Dependency
68
- name: ftw
69
- version_requirements: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: 0.0.42
74
68
  requirement: !ruby/object:Gem::Requirement
75
69
  requirements:
76
70
  - - "~>"
77
71
  - !ruby/object:Gem::Version
78
72
  version: 0.0.42
73
+ name: ftw
79
74
  prerelease: false
80
75
  type: :development
81
- - !ruby/object:Gem::Dependency
82
- name: addressable
83
76
  version_requirements: !ruby/object:Gem::Requirement
84
77
  requirements:
85
78
  - - "~>"
86
79
  - !ruby/object:Gem::Version
87
- version: 2.3.0
80
+ version: 0.0.42
81
+ - !ruby/object:Gem::Dependency
88
82
  requirement: !ruby/object:Gem::Requirement
89
83
  requirements:
90
84
  - - "~>"
91
85
  - !ruby/object:Gem::Version
92
86
  version: 2.3.0
87
+ name: addressable
93
88
  prerelease: false
94
89
  type: :development
95
- - !ruby/object:Gem::Dependency
96
- name: logstash-codec-plain
97
90
  version_requirements: !ruby/object:Gem::Requirement
98
91
  requirements:
99
- - - ">="
92
+ - - "~>"
100
93
  - !ruby/object:Gem::Version
101
- version: '0'
94
+ version: 2.3.0
95
+ - !ruby/object:Gem::Dependency
102
96
  requirement: !ruby/object:Gem::Requirement
103
97
  requirements:
104
98
  - - ">="
105
99
  - !ruby/object:Gem::Version
106
100
  version: '0'
101
+ name: logstash-codec-plain
107
102
  prerelease: false
108
103
  type: :development
109
- - !ruby/object:Gem::Dependency
110
- name: json
111
104
  version_requirements: !ruby/object:Gem::Requirement
112
105
  requirements:
113
106
  - - ">="
114
107
  - !ruby/object:Gem::Version
115
108
  version: '0'
109
+ - !ruby/object:Gem::Dependency
116
110
  requirement: !ruby/object:Gem::Requirement
117
111
  requirements:
118
112
  - - ">="
119
113
  - !ruby/object:Gem::Version
120
114
  version: '0'
115
+ name: json
121
116
  prerelease: false
122
117
  type: :development
123
- - !ruby/object:Gem::Dependency
124
- name: manticore
125
118
  version_requirements: !ruby/object:Gem::Requirement
126
119
  requirements:
127
120
  - - ">="
128
121
  - !ruby/object:Gem::Version
129
- version: 0.5.4
130
- - - "<"
131
- - !ruby/object:Gem::Version
132
- version: 1.0.0
122
+ version: '0'
123
+ - !ruby/object:Gem::Dependency
133
124
  requirement: !ruby/object:Gem::Requirement
134
125
  requirements:
135
126
  - - ">="
@@ -138,50 +129,59 @@ dependencies:
138
129
  - - "<"
139
130
  - !ruby/object:Gem::Version
140
131
  version: 1.0.0
132
+ name: manticore
141
133
  prerelease: false
142
134
  type: :runtime
143
- - !ruby/object:Gem::Dependency
144
- name: logstash-devutils
145
135
  version_requirements: !ruby/object:Gem::Requirement
146
136
  requirements:
147
137
  - - ">="
148
138
  - !ruby/object:Gem::Version
149
- version: '0'
139
+ version: 0.5.4
140
+ - - "<"
141
+ - !ruby/object:Gem::Version
142
+ version: 1.0.0
143
+ - !ruby/object:Gem::Dependency
150
144
  requirement: !ruby/object:Gem::Requirement
151
145
  requirements:
152
146
  - - ">="
153
147
  - !ruby/object:Gem::Version
154
148
  version: '0'
149
+ name: logstash-devutils
155
150
  prerelease: false
156
151
  type: :development
157
- - !ruby/object:Gem::Dependency
158
- name: flores
159
152
  version_requirements: !ruby/object:Gem::Requirement
160
153
  requirements:
161
154
  - - ">="
162
155
  - !ruby/object:Gem::Version
163
156
  version: '0'
157
+ - !ruby/object:Gem::Dependency
164
158
  requirement: !ruby/object:Gem::Requirement
165
159
  requirements:
166
160
  - - ">="
167
161
  - !ruby/object:Gem::Version
168
162
  version: '0'
163
+ name: flores
169
164
  prerelease: false
170
165
  type: :development
171
- - !ruby/object:Gem::Dependency
172
- name: elasticsearch
173
166
  version_requirements: !ruby/object:Gem::Requirement
174
167
  requirements:
175
168
  - - ">="
176
169
  - !ruby/object:Gem::Version
177
170
  version: '0'
171
+ - !ruby/object:Gem::Dependency
178
172
  requirement: !ruby/object:Gem::Requirement
179
173
  requirements:
180
174
  - - ">="
181
175
  - !ruby/object:Gem::Version
182
176
  version: '0'
177
+ name: elasticsearch
183
178
  prerelease: false
184
179
  type: :development
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
185
  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
186
186
  email: info@elastic.co
187
187
  executables: []