fluent-plugin-filter_keys 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/fluent-plugin-filter_keys.gemspec +2 -2
- data/lib/fluent/plugin/out_filter_keys.rb +3 -7
- data/test/plugin/test_out_filter_keys.rb +20 -20
- data/test/test_helper.rb +1 -10
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 941dc2fb072fbbf72e39ce7330183d3dd4823d23353aef40e677df64ff88d87e
|
4
|
+
data.tar.gz: 907d0f3d57ce2a18ba16db825f24b783ea3c52c61e27feffc56a6d85467fa9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8721aca0f462332b3c3821023d814ed066efc4dd868d6d130d613c55797c3da81e5ca7ffc7db75c19de241e38448f7b5f09fa09dd0043a4c740ce6c2c72a881
|
7
|
+
data.tar.gz: 42c3f390dfd310ceb26665f5573b30b0acc15dbcb71ba492ca2d0d84810c4e89b5ea42ace017d28cd36920821739a333122c25754c46367d0e7b1c5ece98d5b5
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-filter_keys"
|
3
|
-
spec.version = "
|
3
|
+
spec.version = "1.0.0"
|
4
4
|
spec.authors = ["Kohei Hasegawa"]
|
5
5
|
spec.email = ["ameutau@gmail.com"]
|
6
6
|
spec.description = %q{Fluentd plugin to filter if a specific key is present or not in event logs.}
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
14
14
|
spec.require_paths = ["lib"]
|
15
15
|
|
16
|
-
spec.add_dependency "fluentd"
|
16
|
+
spec.add_dependency "fluentd", [">= 0.14.0", "< 2"]
|
17
17
|
spec.add_development_dependency "bundler"
|
18
18
|
spec.add_development_dependency "rake"
|
19
19
|
spec.add_development_dependency "test-unit"
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
require 'fluent/plugin/output'
|
2
3
|
|
3
4
|
module Fluent
|
4
5
|
class FilterKeysOutput < Output
|
5
6
|
include Fluent::HandleTagNameMixin
|
6
7
|
|
7
|
-
|
8
|
-
unless method_defined?(:router)
|
9
|
-
define_method("router") { Fluent::Engine }
|
10
|
-
end
|
8
|
+
helpers :event_emitter
|
11
9
|
|
12
10
|
Fluent::Plugin.register_output('filter_keys', self)
|
13
11
|
|
@@ -29,7 +27,7 @@ module Fluent
|
|
29
27
|
|
30
28
|
end
|
31
29
|
|
32
|
-
def
|
30
|
+
def process(tag, es)
|
33
31
|
es.each { |time, record|
|
34
32
|
t = tag.dup
|
35
33
|
filter_record(t, time, record)
|
@@ -39,8 +37,6 @@ module Fluent
|
|
39
37
|
router.emit("#{DISCARD_TAG}.#{t}", time, record) if @add_tag_and_reemit
|
40
38
|
end
|
41
39
|
}
|
42
|
-
|
43
|
-
chain.next
|
44
40
|
end
|
45
41
|
|
46
42
|
def filter_record(tag, time, record)
|
@@ -8,9 +8,9 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
8
8
|
Fluent::Test.setup
|
9
9
|
end
|
10
10
|
|
11
|
-
def create_driver(conf
|
12
|
-
Fluent::Test::
|
13
|
-
Fluent::FilterKeysOutput
|
11
|
+
def create_driver(conf)
|
12
|
+
Fluent::Test::Driver::Output.new(
|
13
|
+
Fluent::FilterKeysOutput
|
14
14
|
).configure(conf)
|
15
15
|
end
|
16
16
|
|
@@ -53,8 +53,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
53
53
|
'bar' => "100",
|
54
54
|
}
|
55
55
|
|
56
|
-
d.run { d.
|
57
|
-
emits = d.
|
56
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
57
|
+
emits = d.events
|
58
58
|
|
59
59
|
assert_equal 1, emits.count
|
60
60
|
assert_equal 'filter_keys.test', emits[0][0]
|
@@ -73,8 +73,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
73
73
|
'bar' => "100",
|
74
74
|
}
|
75
75
|
|
76
|
-
d.run { d.
|
77
|
-
emits = d.
|
76
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
77
|
+
emits = d.events
|
78
78
|
|
79
79
|
assert_equal 1, emits.count
|
80
80
|
assert_equal 'filter_keys.test', emits[0][0]
|
@@ -93,8 +93,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
93
93
|
'at' => "all",
|
94
94
|
}
|
95
95
|
|
96
|
-
d.run { d.
|
97
|
-
emits = d.
|
96
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
97
|
+
emits = d.events
|
98
98
|
|
99
99
|
assert_equal 0, emits.count
|
100
100
|
assert_equal [], emits
|
@@ -110,8 +110,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
110
110
|
'foo' => "50",
|
111
111
|
}
|
112
112
|
|
113
|
-
d.run { d.
|
114
|
-
emits = d.
|
113
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
114
|
+
emits = d.events
|
115
115
|
|
116
116
|
assert_equal 0, emits.count
|
117
117
|
assert_equal [], emits
|
@@ -128,8 +128,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
128
128
|
'bar' => "100",
|
129
129
|
}
|
130
130
|
|
131
|
-
d.run { d.
|
132
|
-
emits = d.
|
131
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
132
|
+
emits = d.events
|
133
133
|
|
134
134
|
assert_equal 0, emits.count
|
135
135
|
assert_equal [], emits
|
@@ -146,8 +146,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
146
146
|
'bar' => "100",
|
147
147
|
}
|
148
148
|
|
149
|
-
d.run { d.
|
150
|
-
emits = d.
|
149
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
150
|
+
emits = d.events
|
151
151
|
|
152
152
|
assert_equal 1, emits.count
|
153
153
|
assert_equal 'filter_keys.test', emits[0][0]
|
@@ -166,10 +166,10 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
166
166
|
'bar' => "100",
|
167
167
|
}
|
168
168
|
|
169
|
-
d.run do
|
170
|
-
3.times { d.
|
169
|
+
d.run(default_tag: 'test') do
|
170
|
+
3.times { d.feed(record) }
|
171
171
|
end
|
172
|
-
emits = d.
|
172
|
+
emits = d.events
|
173
173
|
|
174
174
|
assert_equal 3, emits.count
|
175
175
|
|
@@ -191,8 +191,8 @@ class FilterKeysOutputTest < Test::Unit::TestCase
|
|
191
191
|
'foo' => "50",
|
192
192
|
}
|
193
193
|
|
194
|
-
d.run { d.
|
195
|
-
emits = d.
|
194
|
+
d.run(default_tag: 'test') { d.feed(record) }
|
195
|
+
emits = d.events
|
196
196
|
|
197
197
|
assert_equal 1, emits.count
|
198
198
|
assert_equal 'discarded.filter_keys.test', emits[0][0]
|
data/test/test_helper.rb
CHANGED
@@ -4,16 +4,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
5
|
|
6
6
|
require 'fluent/test'
|
7
|
-
|
8
|
-
unless ENV.has_key?('VERBOSE')
|
9
|
-
nulllogger = Object.new
|
10
|
-
nulllogger.instance_eval {|obj|
|
11
|
-
def method_missing(method, *args)
|
12
|
-
# pass
|
13
|
-
end
|
14
|
-
}
|
15
|
-
$log = nulllogger
|
16
|
-
end
|
7
|
+
require 'fluent/test/driver/output'
|
17
8
|
|
18
9
|
class Test::Unit::TestCase
|
19
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-filter_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Hasegawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.14.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
29
|
+
version: 0.14.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
110
|
version: '0'
|
105
111
|
requirements: []
|
106
112
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.7.6
|
108
114
|
signing_key:
|
109
115
|
specification_version: 4
|
110
116
|
summary: Fluentd plugin to filter if a specific key is present or not in event logs.
|