logstash-filter-elasticsearch 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/CONTRIBUTORS +1 -0
- data/docs/index.asciidoc +11 -0
- data/lib/logstash/filters/elasticsearch.rb +21 -0
- data/lib/logstash/filters/elasticsearch/client.rb +4 -0
- data/logstash-filter-elasticsearch.gemspec +1 -1
- data/spec/filters/elasticsearch_spec.rb +25 -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: 18eb25a6d3942e75e5092fc2316ba4aaecc77cc272258b20db0580404757e104
|
4
|
+
data.tar.gz: 62de9b40a41014e62f287ee7d8001d82f032661320ecb1bb941a2fe8a2e8c380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5c01abd1acc96a76ab3c9e5d49e32f2f7a43c9bad12495e436b1467c6a8d21c987671d70018394f2cf7917c51c7b116b46e2878374a9f865d562b4fa77341c8
|
7
|
+
data.tar.gz: 87dff1c1d7c7a0ea48b3e3ab6c00229f000d546ec154a792c281a2e302a85c501b8609e78d4e889b9fb9092dc2ab19aec1572f7b8ad692964023e7d44979f3c6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 3.9.0
|
2
|
+
- Add support to define a proxy with the proxy config option [#134](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/134)
|
3
|
+
|
1
4
|
## 3.8.0
|
2
5
|
- Added api_key support [#132](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/132)
|
3
6
|
|
data/CONTRIBUTORS
CHANGED
@@ -10,6 +10,7 @@ Contributors:
|
|
10
10
|
* Suyog Rao (suyograo)
|
11
11
|
* Adrian Solom (addrians)
|
12
12
|
* Colin Surprenant (colinsurprenant)
|
13
|
+
* Andres Rodriguez (roaksoax)
|
13
14
|
|
14
15
|
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
15
16
|
Logstash, and you aren't on the list above and want to be, please let us know
|
data/docs/index.asciidoc
CHANGED
@@ -129,6 +129,7 @@ This plugin supports the following configuration options plus the < |
|
129
129
|
| <<plugins-{type}s-{plugin}-hosts>> |<<array,array>>|No
|
130
130
|
| <<plugins-{type}s-{plugin}-index>> |<<string,string>>|No
|
131
131
|
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
|
132
|
+
| <<plugins-{type}s-{plugin}-proxy>> |<<uri,uri>>|No
|
132
133
|
| <<plugins-{type}s-{plugin}-query>> |<<string,string>>|No
|
133
134
|
| <<plugins-{type}s-{plugin}-query_template>> |<<string,string>>|No
|
134
135
|
| <<plugins-{type}s-{plugin}-result_size>> |<<number,number>>|No
|
@@ -171,6 +172,16 @@ Authenticate using Elasticsearch API key. Note that this option also requires en
|
|
171
172
|
|
172
173
|
Format is `id:api_key` where `id` and `api_key` are as returned by the Elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html[Create API key API].
|
173
174
|
|
175
|
+
[id="plugins-{type}s-{plugin}-proxy"]
|
176
|
+
===== `proxy`
|
177
|
+
|
178
|
+
* Value type is <<uri,uri>>
|
179
|
+
* There is no default value for this setting.
|
180
|
+
|
181
|
+
Set the address of a forward HTTP proxy.
|
182
|
+
An empty string is treated as if proxy was not set, and is useful when using
|
183
|
+
environment variables e.g. `proxy => '${LS_PROXY:}'`.
|
184
|
+
|
174
185
|
[id="plugins-{type}s-{plugin}-ca_file"]
|
175
186
|
===== `ca_file`
|
176
187
|
|
@@ -59,6 +59,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
59
59
|
# format is id:api_key (as returned by https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html[Create API key])
|
60
60
|
config :api_key, :validate => :password
|
61
61
|
|
62
|
+
# Set the address of a forward HTTP proxy.
|
63
|
+
config :proxy, :validate => :uri_or_empty
|
64
|
+
|
62
65
|
# SSL
|
63
66
|
config :ssl, :validate => :boolean, :default => false
|
64
67
|
|
@@ -76,6 +79,23 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
76
79
|
|
77
80
|
attr_reader :clients_pool
|
78
81
|
|
82
|
+
##
|
83
|
+
# @override to handle proxy => '' as if none was set
|
84
|
+
# @param value [Array<Object>]
|
85
|
+
# @param validator [nil,Array,Symbol]
|
86
|
+
# @return [Array(true,Object)]: if validation is a success, a tuple containing `true` and the coerced value
|
87
|
+
# @return [Array(false,String)]: if validation is a failure, a tuple containing `false` and the failure reason.
|
88
|
+
def self.validate_value(value, validator)
|
89
|
+
return super unless validator == :uri_or_empty
|
90
|
+
|
91
|
+
value = deep_replace(value)
|
92
|
+
value = hash_or_array(value)
|
93
|
+
|
94
|
+
return true, value.first if value.size == 1 && value.first.empty?
|
95
|
+
|
96
|
+
return super(value, :uri)
|
97
|
+
end
|
98
|
+
|
79
99
|
def register
|
80
100
|
@clients_pool = java.util.concurrent.ConcurrentHashMap.new
|
81
101
|
|
@@ -167,6 +187,7 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
167
187
|
:user => @user,
|
168
188
|
:password => @password,
|
169
189
|
:api_key => @api_key,
|
190
|
+
:proxy => @proxy,
|
170
191
|
:ssl => @ssl,
|
171
192
|
:ca_file => @ca_file,
|
172
193
|
}
|
@@ -15,11 +15,15 @@ module LogStash
|
|
15
15
|
user = options.fetch(:user, nil)
|
16
16
|
password = options.fetch(:password, nil)
|
17
17
|
api_key = options.fetch(:api_key, nil)
|
18
|
+
proxy = options.fetch(:proxy, nil)
|
18
19
|
|
19
20
|
transport_options = {:headers => {}}
|
20
21
|
transport_options[:headers].merge!(setup_basic_auth(user, password))
|
21
22
|
transport_options[:headers].merge!(setup_api_key(api_key))
|
22
23
|
|
24
|
+
logger.warn "Supplied proxy setting (proxy => '') has no effect" if @proxy.eql?('')
|
25
|
+
transport_options[:proxy] = proxy.to_s if proxy && !proxy.eql?('')
|
26
|
+
|
23
27
|
hosts.map! {|h| { host: h, scheme: 'https' } } if ssl
|
24
28
|
# set ca_file even if ssl isn't on, since the host can be an https url
|
25
29
|
ssl_options = { ssl: true, ca_file: options[:ca_file] } if options[:ca_file]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-elasticsearch'
|
4
|
-
s.version = '3.
|
4
|
+
s.version = '3.9.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"
|
@@ -401,6 +401,31 @@ describe LogStash::Filters::Elasticsearch do
|
|
401
401
|
end
|
402
402
|
end
|
403
403
|
end if LOGSTASH_VERSION > '6.0'
|
404
|
+
|
405
|
+
describe "proxy" do
|
406
|
+
context 'valid' do
|
407
|
+
let(:config) { super.merge({ 'proxy' => 'http://localhost:1234' }) }
|
408
|
+
|
409
|
+
it "should set proxy" do
|
410
|
+
plugin.register
|
411
|
+
client = plugin.send(:get_client).client
|
412
|
+
proxy = client.transport.options[:transport_options][:proxy]
|
413
|
+
|
414
|
+
expect( proxy ).to eql "http://localhost:1234"
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
context 'invalid' do
|
419
|
+
let(:config) { super.merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }
|
420
|
+
|
421
|
+
it "should not set proxy" do
|
422
|
+
plugin.register
|
423
|
+
client = plugin.send(:get_client).client
|
424
|
+
|
425
|
+
expect( client.transport.options[:transport_options] ).to_not include(:proxy)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
404
429
|
end
|
405
430
|
|
406
431
|
describe "query template" do
|
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.
|
4
|
+
version: 3.9.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-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|