logstash-filter-rest 0.5.0 → 0.5.1
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/README.md +2 -2
- data/lib/logstash/filters/rest.rb +13 -5
- data/logstash-filter-rest.gemspec +2 -2
- data/spec/filters/rest_spec.rb +17 -0
- 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: 2468297289c6978316c5d27c664d5c162cd0412c
|
4
|
+
data.tar.gz: 6bb1e1e69ef6ac4409e14e4170b81ea46f657094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01227dc244aeb7c369dd7d5127423ce63e21cedc63797052ec30164c7800906141a2b5249de77c4adb8d6f053d7d949790a5a8120d9e1fdcb42f2e256932ab15
|
7
|
+
data.tar.gz: b5d5599af27a350e07122ff29cea1dd94d9f4866005568c38a062bb1a4ac6a4e576161c457f5c59e8b145248943b46a51c9bd7e738714629e186b9daea2edd82
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ This logstash filter provides an easy way to access RESTful Resources within log
|
|
12
12
|
### 1. Installation
|
13
13
|
You can use the built-in plugin tool of Logstash to install the filter:
|
14
14
|
```
|
15
|
-
$LS_HOME/bin/plugin install logstash-filter-rest
|
15
|
+
$LS_HOME/bin/logstash-plugin install logstash-filter-rest
|
16
16
|
```
|
17
17
|
|
18
18
|
Or you can build it yourself:
|
@@ -20,7 +20,7 @@ Or you can build it yourself:
|
|
20
20
|
git clone https://github.com/lucashenning/logstash-filter-rest.git
|
21
21
|
bundle install
|
22
22
|
gem build logstash-filter-rest.gemspec
|
23
|
-
$LS_HOME/bin/plugin install logstash-filter-rest-0.1.0.gem
|
23
|
+
$LS_HOME/bin/logstash-plugin install logstash-filter-rest-0.1.0.gem
|
24
24
|
```
|
25
25
|
|
26
26
|
### 2. Filter Configuration
|
@@ -272,18 +272,26 @@ class LogStash::Filters::Rest < LogStash::Filters::Base
|
|
272
272
|
@logger.debug? && @logger.debug('Parsed request',
|
273
273
|
:request => @request)
|
274
274
|
|
275
|
-
|
276
|
-
|
277
|
-
|
275
|
+
client_error = nil
|
276
|
+
begin
|
277
|
+
code, body = request_http(@request)
|
278
|
+
rescue StandardError => e
|
279
|
+
client_error = e
|
280
|
+
end
|
281
|
+
|
282
|
+
if !client_error && code.between?(200, 299)
|
283
|
+
@logger.debug? && @logger.debug('Success received',
|
278
284
|
:code => code, :body => body)
|
279
285
|
process_response(body, event)
|
280
286
|
else
|
281
287
|
@logger.debug? && @logger.debug('Http error received',
|
282
|
-
:code => code, :body => body
|
288
|
+
:code => code, :body => body,
|
289
|
+
:client_error => client_error)
|
283
290
|
if @fallback.empty?
|
284
291
|
@logger.error('Error in Rest filter',
|
285
292
|
:request => @request, :json => @json,
|
286
|
-
:code => code, :body => body
|
293
|
+
:code => code, :body => body,
|
294
|
+
:client_error => client_error)
|
287
295
|
@tag_on_rest_failure.each { |tag| event.tag(tag) }
|
288
296
|
else
|
289
297
|
@logger.debug? && @logger.debug('Setting fallback',
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-rest'
|
3
|
-
s.version = '0.5.
|
3
|
+
s.version = '0.5.1'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = 'This filter requests data from a RESTful Web Service.'
|
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
|
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 logstash-filter-rest. This gem is not a stand-alone program'
|
7
7
|
s.authors = ['Lucas Henning', 'Gandalf Buscher']
|
8
8
|
s.email = 'mail@hurb.de'
|
9
9
|
s.homepage = 'https://github.com/lucashenning/logstash-filter-rest/'
|
data/spec/filters/rest_spec.rb
CHANGED
@@ -328,4 +328,21 @@ describe LogStash::Filters::Rest do
|
|
328
328
|
expect { subject }.to raise_error(LogStash::ConfigurationError)
|
329
329
|
end
|
330
330
|
end
|
331
|
+
describe 'http client throws exception' do
|
332
|
+
let(:config) do <<-CONFIG
|
333
|
+
filter {
|
334
|
+
rest {
|
335
|
+
request => {
|
336
|
+
url => 'invalid_url'
|
337
|
+
}
|
338
|
+
target => 'rest'
|
339
|
+
}
|
340
|
+
}
|
341
|
+
CONFIG
|
342
|
+
end
|
343
|
+
sample('message' => 'some text') do
|
344
|
+
expect(subject).to_not include('rest')
|
345
|
+
expect(subject.get('tags')).to include('_restfailure')
|
346
|
+
end
|
347
|
+
end
|
331
348
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Henning
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
- - "<"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 2.0.0
|
74
|
-
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install
|
74
|
+
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 logstash-filter-rest. This gem is not a stand-alone program
|
75
75
|
email: mail@hurb.de
|
76
76
|
executables: []
|
77
77
|
extensions: []
|