fluent-plugin-reemit 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92a5d08ac9438d11190b6bfd139a5bbb12cc501f
4
- data.tar.gz: 44a90ef06dbf130eac54648ea03d8ca2e9c9e83f
3
+ metadata.gz: abcbfb610626eb4038ac21e8def1cce86b64af7e
4
+ data.tar.gz: 021b16439391856c15503b60b9623732f912c2c5
5
5
  SHA512:
6
- metadata.gz: d92f99ad94d1d5c8b3a14b460054908e73cce1a409abb0b76943b6bad656204cae444f7900390e9f70e2aed154cb44cb6a3d259e03c7e837df8cb9e96b451860
7
- data.tar.gz: 0d032e86c8f337b3280fdd4933eda7ccabbb87181196627c971da9807f22d5ab6daf85c7700da107f67ad67f1a113290cba5eb03f371c981b4926312325a3c10
6
+ metadata.gz: ebbb3ea9c22854ef7ef31ef10ee921d33c1ac0c77f188c82288273ddd6ff989db0bf661820ed4e5f62c2c0863d33e335cbb89308866c9e77265cde960472c3bd
7
+ data.tar.gz: fc8e173c685930842fa52ae966457dbf245a61dc9214e6dff0ae95924c10573f45626fc3e0f2efa468db9535f4944b435cf647cef3d608ed3e210b537ba66854
@@ -1,7 +1,7 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
4
3
  - 2.0.0
4
+ - 2.1
5
5
  gemfile:
6
6
  - Gemfile
7
7
  - Gemfile.v0.12
@@ -1,3 +1,9 @@
1
+ ## 0.2.0 (2015/08/06)
2
+
3
+ Enhancements:
4
+
5
+ * support multiple reemit statements for same match (thanks to vijaykramesh)
6
+
1
7
  ## 0.1.0 (2014/11/26)
2
8
 
3
9
  Changes:
@@ -2,4 +2,4 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
  gem 'fluent-plugin-flowcounter' # for examples
5
- gem 'fluentd', git: 'git@github.com:fluent/fluentd'
5
+ gem 'fluentd', git: 'https://github.com/fluent/fluentd'
@@ -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>
@@ -13,6 +13,7 @@
13
13
  <store>
14
14
  type flowcounter
15
15
  count_keys *
16
+ unit second
16
17
  </store>
17
18
  <store>
18
19
  type reemit # re-emitted messages are not absorbed by <match **>
@@ -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.1.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) and !@reemit.included?(rule.collector)
77
- if rule.collector.is_a?(Filter)
78
- pipeline ||= Pipeline.new
79
- pipeline.add_filter(rule.collector)
80
- else
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
- # Use Output directly when filter is not matched
85
- pipeline = rule.collector
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
- return pipeline
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
- # @matches.find {|m| m.match(tag) } # this is the original
120
- @matches.find {|m| m.match(tag) and !@reemit.included?(m.output) }
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.1.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: 2014-11-26 00:00:00.000000000 Z
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