fluent-plugin-reemit 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.v0.12 +1 -1
- data/examples/multiple_reemit.conf +36 -0
- data/examples/reemit.conf +1 -0
- data/fluent-plugin-reemit.gemspec +1 -1
- data/lib/fluent/plugin/out_reemit.rb +32 -12
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abcbfb610626eb4038ac21e8def1cce86b64af7e
|
4
|
+
data.tar.gz: 021b16439391856c15503b60b9623732f912c2c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebbb3ea9c22854ef7ef31ef10ee921d33c1ac0c77f188c82288273ddd6ff989db0bf661820ed4e5f62c2c0863d33e335cbb89308866c9e77265cde960472c3bd
|
7
|
+
data.tar.gz: fc8e173c685930842fa52ae966457dbf245a61dc9214e6dff0ae95924c10573f45626fc3e0f2efa468db9535f4944b435cf647cef3d608ed3e210b537ba66854
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.v0.12
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
<source>
|
2
|
+
type gc_stat
|
3
|
+
emit_interval 1s
|
4
|
+
tag gc_stat
|
5
|
+
</source>
|
6
|
+
|
7
|
+
<match flowcount>
|
8
|
+
type stdout
|
9
|
+
</match>
|
10
|
+
|
11
|
+
<match **>
|
12
|
+
type copy
|
13
|
+
<store>
|
14
|
+
type flowcounter
|
15
|
+
count_keys *
|
16
|
+
unit second
|
17
|
+
</store>
|
18
|
+
<store>
|
19
|
+
type reemit # re-emitted messages are not absorbed by <match **>
|
20
|
+
</store>
|
21
|
+
</match>
|
22
|
+
|
23
|
+
|
24
|
+
<match gc_stat>
|
25
|
+
type copy
|
26
|
+
<store>
|
27
|
+
type stdout
|
28
|
+
</store>
|
29
|
+
<store>
|
30
|
+
type reemit # re-emitted messages are not absorbed by <match **> OR the <match gc_stat>
|
31
|
+
</store>
|
32
|
+
</match>
|
33
|
+
|
34
|
+
<match **>
|
35
|
+
type stdout
|
36
|
+
</match>
|
data/examples/reemit.conf
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.
|
6
|
+
gem.version = "0.2.0"
|
7
7
|
gem.authors = ["Naotoshi Seo"]
|
8
8
|
gem.email = "sonots@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/sonots/fluent-plugin-reemit"
|
@@ -70,21 +70,29 @@ module Fluent
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def find(tag)
|
73
|
+
# we want to reemit to the next match after this reemit
|
74
|
+
# this avoids reemiting back to an earlier match that
|
75
|
+
# itself did a reemit to the current match that is reemitting.
|
73
76
|
pipeline = nil
|
77
|
+
found_reemit = false
|
74
78
|
@match_rules.each_with_index { |rule, i|
|
75
79
|
# if rule.match?(tag) # this is the original
|
76
|
-
if rule.match?(tag)
|
77
|
-
if rule.collector
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
if pipeline
|
82
|
-
pipeline.set_output(rule.collector)
|
80
|
+
if rule.match?(tag)
|
81
|
+
if found_reemit && !@reemit.included?(rule.collector)
|
82
|
+
if rule.collector.is_a?(Filter)
|
83
|
+
pipeline ||= Pipeline.new
|
84
|
+
pipeline.add_filter(rule.collector)
|
83
85
|
else
|
84
|
-
|
85
|
-
|
86
|
+
if pipeline
|
87
|
+
pipeline.set_output(rule.collector)
|
88
|
+
else
|
89
|
+
# Use Output directly when filter is not matched
|
90
|
+
pipeline = rule.collector
|
91
|
+
end
|
92
|
+
return pipeline
|
86
93
|
end
|
87
|
-
|
94
|
+
elsif !found_reemit && @reemit.included?(rule.collector)
|
95
|
+
found_reemit = true
|
88
96
|
end
|
89
97
|
end
|
90
98
|
}
|
@@ -116,8 +124,20 @@ module Fluent
|
|
116
124
|
end
|
117
125
|
|
118
126
|
def match(tag)
|
119
|
-
#
|
120
|
-
|
127
|
+
# we want to reemit to the next match after this reemit
|
128
|
+
# this avoids reemiting back to an earlier match that
|
129
|
+
# itself did a reemit to the current match that is reemitting.
|
130
|
+
found_reemit = false
|
131
|
+
@matches.find do |m|
|
132
|
+
if m.match(tag)
|
133
|
+
if found_reemit && !@reemit.included?(m.output)
|
134
|
+
true
|
135
|
+
elsif !found_reemit && @reemit.included?(m.output)
|
136
|
+
found_reemit = true
|
137
|
+
false
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
121
141
|
end
|
122
142
|
end
|
123
143
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- LICENSE
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
|
+
- examples/multiple_reemit.conf
|
98
99
|
- examples/reemit.conf
|
99
100
|
- fluent-plugin-reemit.gemspec
|
100
101
|
- lib/fluent/plugin/out_reemit.rb
|