logstash-input-elasticsearch 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +11 -0
- data/lib/logstash/inputs/elasticsearch.rb +23 -0
- data/logstash-input-elasticsearch.gemspec +1 -1
- data/spec/inputs/elasticsearch_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0255dad9a7c1cdd4b9feae3431528d84c6dca6665d76e01d49a8671cfd50b7ec
|
4
|
+
data.tar.gz: 4f62de728c1b6090338b96d0dc9ed751428bdb35290cc7fc7d677f005733aba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e71209504174bcab3cdd2f937d669dd830c8d9e140c3564f50b43abddd89a7b4dc31ad2bf77439a658429f3026e7f10370eb2870a461a3f86d74774c9588bc
|
7
|
+
data.tar.gz: aac7f02f589d34f167e6a71e0b0825408df1f24908c9c35289a8aec690c7b22c2cbfb94a6e101ab30e9749cc42c7aefda503064698e45b505127d5f3b77f7e2f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 4.6.0
|
2
|
+
- Feat: added option to specify proxy for ES [#114](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/114)
|
3
|
+
|
1
4
|
## 4.5.0
|
2
5
|
- Feat: Added support for cloud_id / cloud_auth configuration [#112](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/112)
|
3
6
|
|
data/docs/index.asciidoc
CHANGED
@@ -95,6 +95,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
95
95
|
| <<plugins-{type}s-{plugin}-hosts>> |<<array,array>>|No
|
96
96
|
| <<plugins-{type}s-{plugin}-index>> |<<string,string>>|No
|
97
97
|
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
|
98
|
+
| <<plugins-{type}s-{plugin}-proxy>> |<<uri,uri>>|No
|
98
99
|
| <<plugins-{type}s-{plugin}-query>> |<<string,string>>|No
|
99
100
|
| <<plugins-{type}s-{plugin}-schedule>> |<<string,string>>|No
|
100
101
|
| <<plugins-{type}s-{plugin}-scroll>> |<<string,string>>|No
|
@@ -231,6 +232,16 @@ The password to use together with the username in the `user` option
|
|
231
232
|
when authenticating to the Elasticsearch server. If set to an empty
|
232
233
|
string authentication will be disabled.
|
233
234
|
|
235
|
+
[id="plugins-{type}s-{plugin}-proxy"]
|
236
|
+
===== `proxy`
|
237
|
+
|
238
|
+
* Value type is <<uri,uri>>
|
239
|
+
* There is no default value for this setting.
|
240
|
+
|
241
|
+
Set the address of a forward HTTP proxy.
|
242
|
+
An empty string is treated as if proxy was not set, this is useful when using
|
243
|
+
environment variables e.g. `proxy => '${LS_PROXY:}'`.
|
244
|
+
|
234
245
|
[id="plugins-{type}s-{plugin}-query"]
|
235
246
|
===== `query`
|
236
247
|
|
@@ -145,6 +145,9 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
|
|
145
145
|
# For more info, check out the https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html#_cloud_auth[Logstash-to-Cloud documentation]
|
146
146
|
config :cloud_auth, :validate => :password
|
147
147
|
|
148
|
+
# Set the address of a forward HTTP proxy.
|
149
|
+
config :proxy, :validate => :uri_or_empty
|
150
|
+
|
148
151
|
# SSL
|
149
152
|
config :ssl, :validate => :boolean, :default => false
|
150
153
|
|
@@ -197,11 +200,31 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
|
|
197
200
|
ssl_options = { :ssl => true, :ca_file => @ca_file } if @ssl && @ca_file
|
198
201
|
ssl_options ||= {}
|
199
202
|
|
203
|
+
@logger.warn "Supplied proxy setting (proxy => '') has no effect" if @proxy.eql?('')
|
204
|
+
|
205
|
+
transport_options[:proxy] = @proxy.to_s if @proxy && !@proxy.eql?('')
|
206
|
+
|
200
207
|
@client = Elasticsearch::Client.new(:hosts => hosts, :transport_options => transport_options,
|
201
208
|
:transport_class => ::Elasticsearch::Transport::Transport::HTTP::Manticore,
|
202
209
|
:ssl => ssl_options)
|
203
210
|
end
|
204
211
|
|
212
|
+
##
|
213
|
+
# @override to handle proxy => '' as if none was set
|
214
|
+
# @param value [Array<Object>]
|
215
|
+
# @param validator [nil,Array,Symbol]
|
216
|
+
# @return [Array(true,Object)]: if validation is a success, a tuple containing `true` and the coerced value
|
217
|
+
# @return [Array(false,String)]: if validation is a failure, a tuple containing `false` and the failure reason.
|
218
|
+
def self.validate_value(value, validator)
|
219
|
+
return super unless validator == :uri_or_empty
|
220
|
+
|
221
|
+
value = deep_replace(value)
|
222
|
+
value = hash_or_array(value)
|
223
|
+
|
224
|
+
return true, value.first if value.size == 1 && value.first.empty?
|
225
|
+
|
226
|
+
return super(value, :uri)
|
227
|
+
end
|
205
228
|
|
206
229
|
def run(output_queue)
|
207
230
|
if @schedule
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-elasticsearch'
|
4
|
-
s.version = '4.
|
4
|
+
s.version = '4.6.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads query results from an Elasticsearch cluster"
|
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"
|
@@ -576,6 +576,29 @@ describe LogStash::Inputs::Elasticsearch do
|
|
576
576
|
end
|
577
577
|
end
|
578
578
|
end if LOGSTASH_VERSION > '6.0'
|
579
|
+
|
580
|
+
describe "proxy" do
|
581
|
+
let(:config) { super.merge({ 'proxy' => 'http://localhost:1234' }) }
|
582
|
+
|
583
|
+
it "should set proxy" do
|
584
|
+
plugin.register
|
585
|
+
client = plugin.send(:client)
|
586
|
+
proxy = client.transport.options[:transport_options][:proxy]
|
587
|
+
|
588
|
+
expect( proxy ).to eql "http://localhost:1234"
|
589
|
+
end
|
590
|
+
|
591
|
+
context 'invalid' do
|
592
|
+
let(:config) { super.merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }
|
593
|
+
|
594
|
+
it "should not set proxy" do
|
595
|
+
plugin.register
|
596
|
+
client = plugin.send(:client)
|
597
|
+
|
598
|
+
expect( client.transport.options[:transport_options] ).to_not include(:proxy)
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
579
602
|
end
|
580
603
|
|
581
604
|
context "when scheduling" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|