logstash-filter-redis 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/filters/redis.rb +5 -4
- data/logstash-filter-redis.gemspec +4 -3
- data/spec/filters/redis_spec.rb +2 -2
- metadata +17 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97796608b3db273ee2e5dbcfd5d3138c93d4030
|
4
|
+
data.tar.gz: 307a47ff45dd3a300860fca70dcc65cb5f5ebff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f213306e13f0349c94bd209c8e3dde6501aebf431a9a04e7e093cfe499b7a26ebb755478e21b4f1e372261fe2d5fa1f26f0a7b0972650c2e17bd6a0b40379129
|
7
|
+
data.tar.gz: 0bc86d0b5eb63b243142b457b0236b6c1159ae75520fa945c2dcefc8b71fa9f14b5ec931fc65452bbe6d675104f4253b9eebc8768e58be1bb826da4f5b8dacb1
|
@@ -78,17 +78,18 @@ class LogStash::Filters::Redis < LogStash::Filters::Base
|
|
78
78
|
return unless event.include?(@field)
|
79
79
|
return if event.include?(@destination) and not @override
|
80
80
|
|
81
|
-
source = event
|
81
|
+
source = event.get(@field).is_a?(Array) ? event.get(@field).first.to_s : event.get(@field).to_s
|
82
82
|
@redis ||= connect
|
83
83
|
val = @redis.get(source)
|
84
84
|
if val
|
85
85
|
begin
|
86
|
-
event
|
86
|
+
event.set(@destination, JSON.parse(val))
|
87
87
|
rescue JSON::ParserError => e
|
88
|
-
event
|
88
|
+
event.set(@destination, val)
|
89
|
+
#event.set("redis-error", "Cannot parse JSON: " + e.to_s)
|
89
90
|
end
|
90
91
|
elsif @fallback
|
91
|
-
event
|
92
|
+
event.set(@destination, @fallback)
|
92
93
|
end
|
93
94
|
|
94
95
|
# filter_matched should go in the last line of our successful code
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-redis'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '0.3.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This filter allows the storage of event fields in a redis key to be retrieved by a later event"
|
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"
|
@@ -20,9 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "
|
23
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
24
|
+
#s.add_runtime_dependency "logstash-core-plugin-api", "= 2.1.16"
|
24
25
|
s.add_runtime_dependency "redis", '>= 3.0.0', '< 4.0.0'
|
25
26
|
|
26
|
-
s.add_development_dependency 'logstash-devutils'
|
27
|
+
s.add_development_dependency 'logstash-devutils', "= 1.1.0"
|
27
28
|
end
|
28
29
|
|
data/spec/filters/redis_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe LogStash::Filters::Redis do
|
|
22
22
|
CONFIG
|
23
23
|
|
24
24
|
sample({"message" => "Test message", "redis-key" => "somekey"}) do
|
25
|
-
insist { subject
|
25
|
+
insist { subject.get("redis-value") } == "somevalue"
|
26
26
|
insist { @redis.get("somekey") } == "somevalue"
|
27
27
|
end
|
28
28
|
end
|
@@ -38,7 +38,7 @@ describe LogStash::Filters::Redis do
|
|
38
38
|
CONFIG
|
39
39
|
|
40
40
|
sample({"message" => "Test message", "redis-key" => "somekey"}) do
|
41
|
-
insist { subject
|
41
|
+
insist { subject.get("redis-value") } == "somevalue"
|
42
42
|
insist { @redis.get("somekey") } == "somevalue"
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meulop
|
@@ -9,22 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.60'
|
20
|
+
- - "<="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '2.99'
|
20
23
|
name: logstash-core-plugin-api
|
21
24
|
prerelease: false
|
22
25
|
type: :runtime
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
30
|
+
version: '1.60'
|
31
|
+
- - "<="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.99'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
@@ -48,17 +54,17 @@ dependencies:
|
|
48
54
|
- !ruby/object:Gem::Dependency
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
50
56
|
requirements:
|
51
|
-
- -
|
57
|
+
- - '='
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
59
|
+
version: 1.1.0
|
54
60
|
name: logstash-devutils
|
55
61
|
prerelease: false
|
56
62
|
type: :development
|
57
63
|
version_requirements: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- -
|
65
|
+
- - '='
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
67
|
+
version: 1.1.0
|
62
68
|
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
|
63
69
|
email: markus.paaso@gmail.com
|
64
70
|
executables: []
|
@@ -97,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
103
|
version: '0'
|
98
104
|
requirements: []
|
99
105
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.6.6
|
101
107
|
signing_key:
|
102
108
|
specification_version: 4
|
103
109
|
summary: This filter allows the storage of event fields in a redis key to be retrieved by a later event
|