fluent-plugin-grep 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/fluent-plugin-grep.gemspec +2 -1
- data/lib/fluent/plugin/out_grep.rb +8 -2
- data/spec/out_grep_spec.rb +26 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08a91d586b4f1b69b5859a4b504d6f20a2dcb885
|
4
|
+
data.tar.gz: 8b1e714a1fcc6121d1ea8b5cdbefb88b76866a67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abf3dd5a6c4638eb2d27d36435844a164c74f0fc94faf551aa24d8cbccc8b29fdfcb5c4bdec3d3aca71f959fa701b7224cbd2200ca9572e8ef1ad67c8dc1ca9
|
7
|
+
data.tar.gz: c59f53e395fc5b0b14082c14452a977ac49e0ee925cfa32e3c99554c1e4d8a3c89d36c827d7c2e3e2ef08ef44302bcf8d0022522321494738227b02692d472fd
|
data/CHANGELOG.md
CHANGED
data/fluent-plugin-grep.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-grep"
|
6
|
-
s.version = "0.3.
|
6
|
+
s.version = "0.3.1"
|
7
7
|
s.authors = ["Naotoshi Seo"]
|
8
8
|
s.email = ["sonots@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/sonots/fluent-plugin-grep"
|
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "rake"
|
23
23
|
s.add_development_dependency "rspec"
|
24
24
|
s.add_development_dependency "pry"
|
25
|
+
s.add_development_dependency "pry-nav"
|
25
26
|
s.add_development_dependency 'coveralls'
|
26
27
|
end
|
@@ -13,6 +13,10 @@ class Fluent::GrepOutput < Fluent::Output
|
|
13
13
|
(1..REGEXP_MAX_NUM).each {|i| config_param :"regexp#{i}", :string, :default => nil }
|
14
14
|
(1..REGEXP_MAX_NUM).each {|i| config_param :"exclude#{i}", :string, :default => nil }
|
15
15
|
|
16
|
+
# for test
|
17
|
+
attr_reader :regexps
|
18
|
+
attr_reader :excludes
|
19
|
+
|
16
20
|
def configure(conf)
|
17
21
|
super
|
18
22
|
|
@@ -20,8 +24,9 @@ class Fluent::GrepOutput < Fluent::Output
|
|
20
24
|
@regexps[@input_key] = Regexp.compile(@regexp) if @input_key and @regexp
|
21
25
|
(1..REGEXP_MAX_NUM).each do |i|
|
22
26
|
next unless conf["regexp#{i}"]
|
23
|
-
key, regexp = conf["regexp#{i}"].split(/
|
27
|
+
key, regexp = conf["regexp#{i}"].split(/ /, 2)
|
24
28
|
raise Fluent::ConfigError, "regexp#{i} does not contain 2 parameters" unless regexp
|
29
|
+
raise Fluent::ConfigError, "regexp#{i} contains a duplicated key, #{key}" if @regexps[key]
|
25
30
|
@regexps[key] = Regexp.compile(regexp)
|
26
31
|
end
|
27
32
|
|
@@ -29,8 +34,9 @@ class Fluent::GrepOutput < Fluent::Output
|
|
29
34
|
@excludes[@input_key] = Regexp.compile(@exclude) if @input_key and @exclude
|
30
35
|
(1..REGEXP_MAX_NUM).each do |i|
|
31
36
|
next unless conf["exclude#{i}"]
|
32
|
-
key, exclude = conf["exclude#{i}"].split(/
|
37
|
+
key, exclude = conf["exclude#{i}"].split(/ /, 2)
|
33
38
|
raise Fluent::ConfigError, "exclude#{i} does not contain 2 parameters" unless exclude
|
39
|
+
raise Fluent::ConfigError, "exclude#{i} contains a duplicated key, #{key}" if @excludes[key]
|
34
40
|
@excludes[key] = Regexp.compile(exclude)
|
35
41
|
end
|
36
42
|
|
data/spec/out_grep_spec.rb
CHANGED
@@ -11,6 +11,22 @@ describe Fluent::GrepOutput do
|
|
11
11
|
|
12
12
|
describe 'test configure' do
|
13
13
|
describe 'bad configuration' do
|
14
|
+
context 'regexp contains a duplicated key' do
|
15
|
+
let(:config) { CONFIG + %[
|
16
|
+
input_key message
|
17
|
+
regexp foo
|
18
|
+
regexp1 message foo
|
19
|
+
]}
|
20
|
+
it { expect { driver }.to raise_error(Fluent::ConfigError) }
|
21
|
+
end
|
22
|
+
context 'exclude contains a duplicated key' do
|
23
|
+
let(:config) { CONFIG + %[
|
24
|
+
input_key message
|
25
|
+
exclude foo
|
26
|
+
exclude1 message foo
|
27
|
+
]}
|
28
|
+
it { expect { driver }.to raise_error(Fluent::ConfigError) }
|
29
|
+
end
|
14
30
|
end
|
15
31
|
|
16
32
|
describe 'good configuration' do
|
@@ -24,6 +40,16 @@ describe Fluent::GrepOutput do
|
|
24
40
|
its(:tag) { should be_nil }
|
25
41
|
its(:add_tag_prefix) { should == 'greped' }
|
26
42
|
end
|
43
|
+
|
44
|
+
context "regexpN can contain a space" do
|
45
|
+
let(:config) { CONFIG + %[regexp1 message foo] }
|
46
|
+
it { subject.regexps['message'].should == Regexp.compile(/ foo/) }
|
47
|
+
end
|
48
|
+
|
49
|
+
context "excludeN can contain a space" do
|
50
|
+
let(:config) { CONFIG + %[exclude1 message foo] }
|
51
|
+
it { subject.excludes['message'].should == Regexp.compile(/ foo/) }
|
52
|
+
end
|
27
53
|
end
|
28
54
|
end
|
29
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-grep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: coveralls
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|