logstash-input-http_poller 4.0.5 → 5.0.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 +7 -0
- data/docs/index.asciidoc +1 -1
- data/lib/logstash/inputs/http_poller.rb +7 -3
- data/logstash-input-http_poller.gemspec +3 -2
- data/spec/inputs/http_poller_spec.rb +34 -0
- metadata +21 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dae0f4077b0291250677f8c0dec67e0c713bba9d6994b4b2406fbffb47f92459
|
4
|
+
data.tar.gz: 05a45a34f59b148c8c04c73501f06fe1d7c41e3bde6ab6f814ca0e7a07a9f1e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9522d889fe4f3ae718783963437ed7c360e59755979d9e9db98cb5aef4569e1c4ffb10ca9f92d2f0de0d9c072104edf78b1d1c6b55a2209fdade646c2b14bd01
|
7
|
+
data.tar.gz: 7dd5226d0a736cc25a4189a3751d3bf4bfa6f11c028858f2fc35cea2286e3b35ee5237b349df143d66f5316391bf33ed07302352d3be04d36be4dca770da5105
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 5.0.0
|
2
|
+
- Removed obsolete field `interval`
|
3
|
+
|
4
|
+
## 4.0.6
|
5
|
+
- Changed `schedule` entry to show that it is required
|
6
|
+
[#102](https://github.com/logstash-plugins/logstash-input-http_poller/pull/102)
|
7
|
+
|
1
8
|
## 4.0.5
|
2
9
|
- Docs: Set the default_codec doc attribute.
|
3
10
|
|
data/docs/index.asciidoc
CHANGED
@@ -114,7 +114,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
114
114
|
| <<plugins-{type}s-{plugin}-proxy>> |<<,>>|No
|
115
115
|
| <<plugins-{type}s-{plugin}-request_timeout>> |<<number,number>>|No
|
116
116
|
| <<plugins-{type}s-{plugin}-retry_non_idempotent>> |<<boolean,boolean>>|No
|
117
|
-
| <<plugins-{type}s-{plugin}-schedule>> |<<hash,hash>>|
|
117
|
+
| <<plugins-{type}s-{plugin}-schedule>> |<<hash,hash>>|Yes
|
118
118
|
| <<plugins-{type}s-{plugin}-socket_timeout>> |<<number,number>>|No
|
119
119
|
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
|
120
120
|
| <<plugins-{type}s-{plugin}-truststore>> |a valid filesystem path|No
|
@@ -17,8 +17,6 @@ class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
|
17
17
|
# The name and the url will be passed in the outputed event
|
18
18
|
config :urls, :validate => :hash, :required => true
|
19
19
|
|
20
|
-
config :interval, :validate => :number, :obsolete => "The interval options is obsolete. Use schedule instead"
|
21
|
-
|
22
20
|
# Schedule of when to periodically poll from the urls
|
23
21
|
# Format: A hash with
|
24
22
|
# + key: "cron" | "every" | "in" | "at"
|
@@ -165,7 +163,7 @@ class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
|
165
163
|
# If there is a usable response. HEAD requests are `nil` and empty get
|
166
164
|
# responses come up as "" which will cause the codec to not yield anything
|
167
165
|
if body && body.size > 0
|
168
|
-
@codec
|
166
|
+
decode_and_flush(@codec, body) do |decoded|
|
169
167
|
event = @target ? LogStash::Event.new(@target => decoded.to_hash) : decoded
|
170
168
|
handle_decoded_event(queue, name, request, response, event, execution_time)
|
171
169
|
end
|
@@ -175,6 +173,12 @@ class LogStash::Inputs::HTTP_Poller < LogStash::Inputs::Base
|
|
175
173
|
end
|
176
174
|
end
|
177
175
|
|
176
|
+
private
|
177
|
+
def decode_and_flush(codec, body, &yielder)
|
178
|
+
codec.decode(body, &yielder)
|
179
|
+
codec.flush(&yielder)
|
180
|
+
end
|
181
|
+
|
178
182
|
private
|
179
183
|
def handle_decoded_event(queue, name, request, response, event, execution_time)
|
180
184
|
apply_metadata(event, name, request, response, execution_time)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-http_poller'
|
3
|
-
s.version = '
|
3
|
+
s.version = '5.0.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Decodes the output of an HTTP API into events"
|
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"
|
@@ -20,11 +20,12 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Gem dependencies
|
21
21
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
22
22
|
s.add_runtime_dependency 'logstash-codec-plain'
|
23
|
-
s.add_runtime_dependency 'logstash-mixin-http_client', "
|
23
|
+
s.add_runtime_dependency 'logstash-mixin-http_client', "~> 7"
|
24
24
|
s.add_runtime_dependency 'stud', "~> 0.0.22"
|
25
25
|
s.add_runtime_dependency 'rufus-scheduler', "~>3.0.9"
|
26
26
|
|
27
27
|
s.add_development_dependency 'logstash-codec-json'
|
28
|
+
s.add_development_dependency 'logstash-codec-line'
|
28
29
|
s.add_development_dependency 'logstash-devutils'
|
29
30
|
s.add_development_dependency 'flores'
|
30
31
|
s.add_development_dependency 'timecop'
|
@@ -462,6 +462,40 @@ describe LogStash::Inputs::HTTP_Poller do
|
|
462
462
|
expect(event.get(target)).to include(payload_normalized)
|
463
463
|
end
|
464
464
|
end
|
465
|
+
|
466
|
+
context 'using a line codec' do
|
467
|
+
let(:opts) do
|
468
|
+
default_opts.merge({"codec" => "line"})
|
469
|
+
end
|
470
|
+
subject(:events) do
|
471
|
+
[].tap do |events|
|
472
|
+
events << queue.pop until queue.empty?
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
context 'when response has a trailing newline' do
|
477
|
+
let(:response_body) { "one\ntwo\nthree\nfour\n" }
|
478
|
+
it 'emits all events' do
|
479
|
+
expect(events.size).to equal(4)
|
480
|
+
messages = events.map{|e| e.get('message')}
|
481
|
+
expect(messages).to include('one')
|
482
|
+
expect(messages).to include('two')
|
483
|
+
expect(messages).to include('three')
|
484
|
+
expect(messages).to include('four')
|
485
|
+
end
|
486
|
+
end
|
487
|
+
context 'when response has no trailing newline' do
|
488
|
+
let(:response_body) { "one\ntwo\nthree\nfour" }
|
489
|
+
it 'emits all events' do
|
490
|
+
expect(events.size).to equal(4)
|
491
|
+
messages = events.map{|e| e.get('message')}
|
492
|
+
expect(messages).to include('one')
|
493
|
+
expect(messages).to include('two')
|
494
|
+
expect(messages).to include('three')
|
495
|
+
expect(messages).to include('four')
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
465
499
|
end
|
466
500
|
end
|
467
501
|
|
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:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,23 +48,17 @@ dependencies:
|
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 6.0.0
|
54
|
-
- - "<"
|
51
|
+
- - "~>"
|
55
52
|
- !ruby/object:Gem::Version
|
56
|
-
version: 7
|
53
|
+
version: '7'
|
57
54
|
name: logstash-mixin-http_client
|
58
55
|
prerelease: false
|
59
56
|
type: :runtime
|
60
57
|
version_requirements: !ruby/object:Gem::Requirement
|
61
58
|
requirements:
|
62
|
-
- - "
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 6.0.0
|
65
|
-
- - "<"
|
59
|
+
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: 7
|
61
|
+
version: '7'
|
68
62
|
- !ruby/object:Gem::Dependency
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
70
64
|
requirements:
|
@@ -107,6 +101,20 @@ dependencies:
|
|
107
101
|
- - ">="
|
108
102
|
- !ruby/object:Gem::Version
|
109
103
|
version: '0'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
name: logstash-codec-line
|
111
|
+
prerelease: false
|
112
|
+
type: :development
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
110
118
|
- !ruby/object:Gem::Dependency
|
111
119
|
requirement: !ruby/object:Gem::Requirement
|
112
120
|
requirements:
|
@@ -188,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
196
|
version: '0'
|
189
197
|
requirements: []
|
190
198
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.6.
|
199
|
+
rubygems_version: 2.6.13
|
192
200
|
signing_key:
|
193
201
|
specification_version: 4
|
194
202
|
summary: Decodes the output of an HTTP API into events
|