logstash-output-elasticsearch 1.0.2-java → 1.0.3-java
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dfe982500b400c2db41641f7c8e272aae50f445
|
4
|
+
data.tar.gz: b48ebe308211abe1cd74c829db3f2570c3a98024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b72b8cd4364ad893b2739dca89836d304bd7a532839271665217ce9efec07bd56ffe34a692cf279586ea9403eef608894084922abd72cf31ad5cfefb2b7f58b7
|
7
|
+
data.tar.gz: b3417490d91c9540c5f6aaf7763fbb4473cf14d89fff4fbfc39d95ee6ed245e2e2ac120475be282d686b73de0334fed54318fd39080c66faef01160460f9b0a1
|
data/CHANGELOG.md
CHANGED
@@ -309,6 +309,12 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
309
309
|
# Set max interval between bulk retries
|
310
310
|
config :retry_max_interval, :validate => :number, :default => 5
|
311
311
|
|
312
|
+
# Set the address of a forward HTTP proxy. Must be used with the 'http' protocol
|
313
|
+
# Can be either a string, such as 'http://localhost:123' or a hash in the form
|
314
|
+
# {host: 'proxy.org' port: 80 scheme: 'http'}
|
315
|
+
# Note, this is NOT a SOCKS proxy, but a plain HTTP proxy
|
316
|
+
config :proxy
|
317
|
+
|
312
318
|
public
|
313
319
|
def register
|
314
320
|
@submit_mutex = Mutex.new
|
@@ -372,6 +378,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
372
378
|
end
|
373
379
|
|
374
380
|
client_settings.merge! setup_ssl()
|
381
|
+
client_settings.merge! setup_proxy()
|
375
382
|
|
376
383
|
common_options = {
|
377
384
|
:protocol => @protocol,
|
@@ -593,6 +600,26 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
593
600
|
@logger.debug? and @logger.debug("Switched current elasticsearch client to ##{@client_idx} at #{@host[@client_idx]}")
|
594
601
|
end
|
595
602
|
|
603
|
+
private
|
604
|
+
def setup_proxy
|
605
|
+
return {} unless @proxy
|
606
|
+
|
607
|
+
if @protocol != "http"
|
608
|
+
raise(LogStash::ConfigurationError, "Proxy is not supported for '#{@protocol}'. Change the protocol to 'http' if you need HTTP proxy.")
|
609
|
+
end
|
610
|
+
|
611
|
+
# Symbolize keys
|
612
|
+
proxy = if @proxy.is_a?(Hash)
|
613
|
+
Hash[@proxy.map {|k,v| [k.to_sym, v]}]
|
614
|
+
elsif @proxy.is_a?(String)
|
615
|
+
@proxy
|
616
|
+
else
|
617
|
+
raise LogStash::ConfigurationError, "Expected 'proxy' to be a string or hash, not '#{@proxy}''!"
|
618
|
+
end
|
619
|
+
|
620
|
+
return {:proxy => proxy}
|
621
|
+
end
|
622
|
+
|
596
623
|
private
|
597
624
|
def setup_ssl
|
598
625
|
return {} unless @ssl
|
@@ -68,7 +68,8 @@ module LogStash::Outputs::Elasticsearch
|
|
68
68
|
:ssl => options[:client_settings][:ssl],
|
69
69
|
:transport_options => { # manticore settings so we
|
70
70
|
:socket_timeout => 0, # do not timeout socket reads
|
71
|
-
:request_timeout => 0 # and requests
|
71
|
+
:request_timeout => 0, # and requests
|
72
|
+
:proxy => options[:client_settings][:proxy]
|
72
73
|
},
|
73
74
|
:transport_class => ::Elasticsearch::Transport::Transport::HTTP::Manticore
|
74
75
|
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative "../../../spec/es_spec_helper"
|
2
|
+
require 'stud/temporary'
|
3
|
+
require 'elasticsearch'
|
4
|
+
require "logstash/outputs/elasticsearch"
|
5
|
+
|
6
|
+
describe "Proxy option" do
|
7
|
+
let(:settings) {
|
8
|
+
{
|
9
|
+
"protocol" => "http",
|
10
|
+
"host" => "node01",
|
11
|
+
"proxy" => proxy
|
12
|
+
}
|
13
|
+
}
|
14
|
+
subject {
|
15
|
+
LogStash::Outputs::ElasticSearch.new(settings)
|
16
|
+
}
|
17
|
+
|
18
|
+
before do
|
19
|
+
allow(::Elasticsearch::Client).to receive(:new).with(any_args)
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "valid configs" do
|
23
|
+
before do
|
24
|
+
subject.register
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when specified as a string" do
|
28
|
+
let(:proxy) { "http://127.0.0.1:1234" }
|
29
|
+
|
30
|
+
it "should set the proxy to the exact value" do
|
31
|
+
expect(::Elasticsearch::Client).to have_received(:new) do |options|
|
32
|
+
expect(options[:transport_options][:proxy]).to eql(proxy)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when specified as a hash" do
|
38
|
+
let(:proxy) { {"host" => "127.0.0.1", "protocol" => "http"} }
|
39
|
+
|
40
|
+
it "should pass through the proxy values as symbols" do
|
41
|
+
expected = {:host => proxy["host"], :protocol => proxy["protocol"]}
|
42
|
+
expect(::Elasticsearch::Client).to have_received(:new) do |options|
|
43
|
+
expect(options[:transport_options][:proxy]).to eql(expected)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "invalid configs" do
|
50
|
+
let(:proxy) { ["bad", "stuff"] }
|
51
|
+
|
52
|
+
it "should have raised an exception" do
|
53
|
+
expect {
|
54
|
+
subject.register
|
55
|
+
}.to raise_error(LogStash::ConfigurationError)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
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: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- spec/integration/outputs/templates_spec.rb
|
197
197
|
- spec/integration/outputs/transport_create_spec.rb
|
198
198
|
- spec/unit/outputs/elasticsearch/protocol_spec.rb
|
199
|
+
- spec/unit/outputs/elasticsearch_proxy_spec.rb
|
199
200
|
- spec/unit/outputs/elasticsearch_spec.rb
|
200
201
|
- spec/unit/outputs/elasticsearch_ssl_spec.rb
|
201
202
|
- vendor/jar-dependencies/runtime-jars/antlr-runtime-3.5.jar
|
@@ -251,5 +252,6 @@ test_files:
|
|
251
252
|
- spec/integration/outputs/templates_spec.rb
|
252
253
|
- spec/integration/outputs/transport_create_spec.rb
|
253
254
|
- spec/unit/outputs/elasticsearch/protocol_spec.rb
|
255
|
+
- spec/unit/outputs/elasticsearch_proxy_spec.rb
|
254
256
|
- spec/unit/outputs/elasticsearch_spec.rb
|
255
257
|
- spec/unit/outputs/elasticsearch_ssl_spec.rb
|