fluent-plugin-reemit 0.0.3 → 0.0.4
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/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/fluent-plugin-reemit.gemspec +1 -1
- data/lib/fluent/plugin/out_reemit.rb +14 -8
- data/spec/out_reemit_spec.rb +58 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e813b632ab6a8e9d25674b0797d86e164c0f0dcf
|
4
|
+
data.tar.gz: d9bd28e6b7d18eed818154cf8a6e0305ee662b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e54b924c5b92305d5a3ef091dd9b479b34612c2451f3da471957e87f346e64df976ed2370fd64216681c8a6beb9e1e77887796451b09bea3edc84129c357726
|
7
|
+
data.tar.gz: 34e643e7411db05b9af1b2f3b1c98d8c35ac14d60f6de187949bbfdcf53e48a5b9e3a253a7cb7b122294bbe489d348c224c1dfaa7b5f30d5cd10c91aaba41be6
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "fluent-plugin-reemit"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.4"
|
7
7
|
gem.authors = ["Naotoshi Seo"]
|
8
8
|
gem.email = "sonots@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/sonots/fluent-plugin-reemit"
|
@@ -23,8 +23,6 @@ module Fluent
|
|
23
23
|
log.warn "reemit: #{e.class} #{e.message} #{e.backtrace.first}"
|
24
24
|
end
|
25
25
|
|
26
|
-
private
|
27
|
-
|
28
26
|
# My Engine.emit
|
29
27
|
def engine_emit(tag, es)
|
30
28
|
target = @match_cache[tag]
|
@@ -38,11 +36,9 @@ module Fluent
|
|
38
36
|
# My Engine.match
|
39
37
|
def engine_match(tag)
|
40
38
|
# @matches.find {|m| m.match(tag) } # original Engine.match
|
41
|
-
Engine.matches.find {|m|
|
39
|
+
Engine.matches.find {|m| match_without_self(m, tag) }
|
42
40
|
end
|
43
41
|
|
44
|
-
# Currently support only
|
45
|
-
#
|
46
42
|
# <match foo.bar>
|
47
43
|
# type reemit
|
48
44
|
# </match>
|
@@ -55,10 +51,20 @@ module Fluent
|
|
55
51
|
# type reemit
|
56
52
|
# </store>
|
57
53
|
# </match>
|
58
|
-
def
|
59
|
-
return false if m.output
|
60
|
-
return false if m.output.kind_of?(MultiOutput) and m.output.outputs.include?(self)
|
54
|
+
def match_without_self(m, tag)
|
55
|
+
return false if contain_self?(m.output)
|
61
56
|
m.match(tag)
|
62
57
|
end
|
58
|
+
|
59
|
+
def contain_self?(output)
|
60
|
+
if output.kind_of?(MultiOutput)
|
61
|
+
output.outputs.each do |o|
|
62
|
+
return true if contain_self?(o)
|
63
|
+
end
|
64
|
+
else
|
65
|
+
return true if output == self
|
66
|
+
end
|
67
|
+
false
|
68
|
+
end
|
63
69
|
end
|
64
70
|
end
|
data/spec/out_reemit_spec.rb
CHANGED
@@ -3,5 +3,62 @@ require_relative 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Fluent::ReemitOutput do
|
5
5
|
before { Fluent::Test.setup }
|
6
|
-
|
6
|
+
def create_driver(config, tag = 'test')
|
7
|
+
Fluent::Test::OutputTestDriver.new(Fluent::CopyOutput, tag).configure(config)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#contain_self?' do
|
11
|
+
it 'should contain self' do
|
12
|
+
config = %[
|
13
|
+
<store>
|
14
|
+
type reemit
|
15
|
+
</store>
|
16
|
+
<store>
|
17
|
+
type stdout
|
18
|
+
</store>
|
19
|
+
]
|
20
|
+
output = create_driver(config).instance
|
21
|
+
reemit = output.outputs.first
|
22
|
+
reemit.contain_self?(output).should be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should not contain self' do
|
26
|
+
reemit_config = %[
|
27
|
+
<store>
|
28
|
+
type reemit
|
29
|
+
</store>
|
30
|
+
<store>
|
31
|
+
type stdout
|
32
|
+
</store>
|
33
|
+
]
|
34
|
+
noreemit_config = %[
|
35
|
+
<store>
|
36
|
+
type stdout
|
37
|
+
</store>
|
38
|
+
]
|
39
|
+
reemit = create_driver(reemit_config).instance.outputs.first
|
40
|
+
output = create_driver(noreemit_config).instance
|
41
|
+
reemit.contain_self?(output).should be_false
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should contain self in deep' do
|
45
|
+
config = %[
|
46
|
+
<store>
|
47
|
+
type stdout
|
48
|
+
</store>
|
49
|
+
<store>
|
50
|
+
type copy
|
51
|
+
<store>
|
52
|
+
type stdout
|
53
|
+
</store>
|
54
|
+
<store>
|
55
|
+
type reemit
|
56
|
+
</store>
|
57
|
+
</store>
|
58
|
+
]
|
59
|
+
output = create_driver(config).instance
|
60
|
+
reemit = output.outputs[1].outputs[1]
|
61
|
+
reemit.contain_self?(output).should be_true
|
62
|
+
end
|
63
|
+
end
|
7
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-reemit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|