logstash-input-http_poller 1.1.1 → 1.1.2
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/lib/logstash/inputs/http_poller.rb +2 -8
- data/logstash-input-http_poller.gemspec +2 -2
- data/spec/inputs/http_poller_spec.rb +2 -27
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a9679db9386a407c380a4d321acacf4a40fe84
|
4
|
+
data.tar.gz: 02a990f7c35be4e02feb73d2979cd72e40f999a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea3921bd5e960c25b2c4158a421c06240c2f9ac2911e993d6d831cf2a130b41b73083d04e82421b2fe7bb454a90ee9003e72f4c9192d82dbe915e97f23de925e
|
7
|
+
data.tar.gz: 4da38a804b10b3a76b9a455745771421ad9aec1a44a86d418ccbad4779820fe50d3cfbb449b8a7c1fea8547ed5b2c505eb06f5b7937dbcb6cf3b15c8eee0debf
|
data/CHANGELOG.md
CHANGED
@@ -18,7 +18,6 @@ require "manticore"
|
|
18
18
|
# # Supports all options supported by ruby's Manticore HTTP client
|
19
19
|
# method => get
|
20
20
|
# url => "http://localhost:9200/_cluster/health"
|
21
|
-
# automatic_retries => 2 # Retry the URL twice
|
22
21
|
# headers => {
|
23
22
|
# Accept => "application/json"
|
24
23
|
# }
|
@@ -45,11 +44,6 @@ require "manticore"
|
|
45
44
|
class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
46
45
|
include LogStash::PluginMixins::HttpClient
|
47
46
|
|
48
|
-
# Default client options for requests
|
49
|
-
DEFAULT_SPEC = {
|
50
|
-
:automatic_retries => 0 # By default manticore retries 3 times, make this explicit
|
51
|
-
}
|
52
|
-
|
53
47
|
config_name "http_poller"
|
54
48
|
|
55
49
|
default :codec, "json"
|
@@ -88,10 +82,10 @@ class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
|
88
82
|
private
|
89
83
|
def normalize_request(url_or_spec)
|
90
84
|
if url_or_spec.is_a?(String)
|
91
|
-
res = [:get, url_or_spec
|
85
|
+
res = [:get, url_or_spec]
|
92
86
|
elsif url_or_spec.is_a?(Hash)
|
93
87
|
# The client will expect keys / values
|
94
|
-
spec = Hash[
|
88
|
+
spec = Hash[url_or_spec.clone.map {|k,v| [k.to_sym, v] }] # symbolize keys
|
95
89
|
|
96
90
|
# method and url aren't really part of the options, so we pull them out
|
97
91
|
method = (spec.delete(:method) || :get).to_sym.downcase
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-http_poller'
|
3
|
-
s.version = '1.1.
|
3
|
+
s.version = '1.1.2'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Poll HTTP endpoints with Logstash."
|
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/plugin install gemname. This gem is not a stand-alone program."
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency "logstash-core", '>= 1.5.0', '< 2.0.0'
|
21
21
|
s.add_runtime_dependency 'logstash-codec-plain'
|
22
22
|
s.add_runtime_dependency 'logstash-codec-json'
|
23
|
-
s.add_runtime_dependency 'logstash-mixin-http_client', ">= 1.0.
|
23
|
+
s.add_runtime_dependency 'logstash-mixin-http_client', ">= 1.0.1"
|
24
24
|
s.add_runtime_dependency 'stud'
|
25
25
|
s.add_runtime_dependency 'manticore'
|
26
26
|
|
@@ -60,9 +60,7 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
60
60
|
|
61
61
|
it "should to set additional options correctly" do
|
62
62
|
opts = normalized.length > 2 ? normalized[2] : nil
|
63
|
-
|
64
|
-
expected = Hash[LogStash::Inputs::HTTP_Poller::DEFAULT_SPEC.merge(spec_opts || {}).map {|k,v| [k.to_sym,v]} ]
|
65
|
-
expect(opts).to eql(expected)
|
63
|
+
expect(opts).to eql(spec_opts)
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
@@ -90,29 +88,6 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
90
88
|
}.merge(Hash[spec_opts.map {|k,v| [k.to_s,v]}])
|
91
89
|
end
|
92
90
|
|
93
|
-
it "should include the default options" do
|
94
|
-
expect(normalized[2]).to include(LogStash::Inputs::HTTP_Poller::DEFAULT_SPEC)
|
95
|
-
end
|
96
|
-
|
97
|
-
context "when overiding a spec default" do
|
98
|
-
let(:retries) { 3 }
|
99
|
-
let(:url) do
|
100
|
-
{
|
101
|
-
"url" => spec_url,
|
102
|
-
"method" => spec_method,
|
103
|
-
"automatic_retries" => retries
|
104
|
-
}.merge(Hash[spec_opts.map {|k,v| [k.to_s,v]}])
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should override the default options" do
|
108
|
-
expect(normalized[2]).to include(:automatic_retries => retries)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should not include the defaults" do
|
112
|
-
expect(normalized[2]).not_to include(LogStash::Inputs::HTTP_Poller::DEFAULT_SPEC)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
91
|
include_examples("a normalized request")
|
117
92
|
end
|
118
93
|
|
@@ -186,7 +161,7 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
186
161
|
|
187
162
|
it "should have the correct request url" do
|
188
163
|
if url.is_a?(Hash) # If the url was specified as a complex test the whole thing
|
189
|
-
expect(metadata["request"]).to
|
164
|
+
expect(metadata["request"]).to eql(url)
|
190
165
|
else # Otherwise we have to make some assumptions
|
191
166
|
expect(metadata["request"]["url"]).to eql(url)
|
192
167
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-http_poller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrewvc
|
@@ -64,12 +64,12 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 1.0.
|
67
|
+
version: 1.0.1
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - '>='
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 1.0.
|
72
|
+
version: 1.0.1
|
73
73
|
prerelease: false
|
74
74
|
type: :runtime
|
75
75
|
- !ruby/object:Gem::Dependency
|