fluent-plugin-reemit 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-reemit.gemspec +1 -1
- data/lib/fluent/plugin/out_reemit.rb +20 -29
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de2b0c078c5715c5079548c99f2efbbc838fc881
|
4
|
+
data.tar.gz: 640bf1b9a340eb7fe09af815f65ba145b5dd8318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cfb6bdd0b00d62162754deb1d1480450389755e57d5f6f6696d59890361578b66c759cc45a04be2414d97154f5c7553f6789b12269f0c970531c672535b9c39
|
7
|
+
data.tar.gz: 9b8b6fdab2004582082c62881064feb5d5cef4517b47534a844c7f8d92bbf56545cbd169d3d05ae60aac0d278ff7ba4ca6a6c11dab168e5bcdeb09ed85b953f3
|
data/CHANGELOG.md
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.3.
|
6
|
+
gem.version = "0.3.1"
|
7
7
|
gem.authors = ["Naotoshi Seo"]
|
8
8
|
gem.email = "sonots@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/sonots/fluent-plugin-reemit"
|
@@ -14,21 +14,19 @@ module Fluent
|
|
14
14
|
|
15
15
|
def configure(conf)
|
16
16
|
super
|
17
|
+
|
18
|
+
major, minor, patch = Fluent::VERSION.split('.').map(&:to_i)
|
19
|
+
if major > 0 || (major == 0 && minor >= 14)
|
20
|
+
@router = V14EventRouter.new(self)
|
21
|
+
elsif major == 0 && minor >= 12
|
22
|
+
@router = V12EventRouter.new(self)
|
23
|
+
else
|
24
|
+
@router = V10EventRouter.new(self)
|
25
|
+
end
|
17
26
|
end
|
18
27
|
|
19
28
|
def start
|
20
29
|
super
|
21
|
-
event_router = Engine.instance_variable_get(:@event_router)
|
22
|
-
@router =
|
23
|
-
if event_router
|
24
|
-
if v14?(event_router)
|
25
|
-
V14EventRouter.new(self)
|
26
|
-
else
|
27
|
-
V12EventRouter.new(self)
|
28
|
-
end
|
29
|
-
else
|
30
|
-
V10Engine.new(self)
|
31
|
-
end
|
32
30
|
end
|
33
31
|
|
34
32
|
def emit(tag, es, chain)
|
@@ -38,11 +36,6 @@ module Fluent
|
|
38
36
|
log.warn "reemit: #{e.class} #{e.message} #{e.backtrace.first}"
|
39
37
|
end
|
40
38
|
|
41
|
-
def v14?(event_router)
|
42
|
-
default_collector = event_router.instance_variable_get(:@default_collector)
|
43
|
-
default_collector.respond_to?(:emit_events)
|
44
|
-
end
|
45
|
-
|
46
39
|
def included?(collector)
|
47
40
|
return false if collector.nil?
|
48
41
|
if collector == self
|
@@ -60,23 +53,23 @@ module Fluent
|
|
60
53
|
class V12EventRouter
|
61
54
|
def initialize(reemit)
|
62
55
|
@reemit = reemit
|
63
|
-
@event_router = Engine.
|
64
|
-
@chain = @event_router.instance_variable_get(:@chain)
|
65
|
-
@emit_error_handler = @event_router.
|
56
|
+
@event_router = Engine.root_agent.event_router
|
57
|
+
@chain = @event_router.instance_variable_get(:@chain) # only v0.12
|
58
|
+
@emit_error_handler = @event_router.emit_error_handler
|
66
59
|
@match_rules = @event_router.instance_variable_get(:@match_rules)
|
67
|
-
@default_collector = @event_router.
|
68
|
-
# @match_cache = @event_router.
|
60
|
+
@default_collector = @event_router.default_collector
|
61
|
+
# @match_cache = @event_router.match_cache
|
69
62
|
@match_cache = EventRouter::MatchCache.new # need to use a different cache
|
70
63
|
end
|
71
64
|
|
72
|
-
#
|
65
|
+
# copy from fluentd
|
73
66
|
def emit_stream(tag, es)
|
74
67
|
match(tag).emit(tag, es, @chain)
|
75
68
|
rescue => e
|
76
69
|
@emit_error_handler.handle_emits_error(tag, es, e)
|
77
70
|
end
|
78
71
|
|
79
|
-
#
|
72
|
+
# copy from fluentd
|
80
73
|
def match(tag)
|
81
74
|
collector = @match_cache.get(tag) {
|
82
75
|
c = find(tag) || @default_collector
|
@@ -85,8 +78,7 @@ module Fluent
|
|
85
78
|
end
|
86
79
|
|
87
80
|
def find(tag)
|
88
|
-
# We want to reemit messages to the next `<match>`
|
89
|
-
# to avoid reemiting back to an above or current `<match>`
|
81
|
+
# We want to reemit messages to the **next** `<match>`
|
90
82
|
pipeline = nil
|
91
83
|
found_reemit = false
|
92
84
|
@match_rules.each_with_index { |rule, i|
|
@@ -123,7 +115,7 @@ module Fluent
|
|
123
115
|
|
124
116
|
# Almost same as V12EventRouter but it must call #emit_events instead of #emit.
|
125
117
|
class V14EventRouter < V12EventRouter
|
126
|
-
#
|
118
|
+
# copy from fluentd
|
127
119
|
def emit_stream(tag, es)
|
128
120
|
match(tag).emit_events(tag, es)
|
129
121
|
rescue => e
|
@@ -131,7 +123,7 @@ module Fluent
|
|
131
123
|
end
|
132
124
|
end
|
133
125
|
|
134
|
-
class
|
126
|
+
class V10EventRouter
|
135
127
|
def initialize(reemit)
|
136
128
|
@reemit = reemit
|
137
129
|
@matches = Engine.matches
|
@@ -148,8 +140,7 @@ module Fluent
|
|
148
140
|
end
|
149
141
|
|
150
142
|
def match(tag)
|
151
|
-
# We want to reemit messages to the next `<match>`
|
152
|
-
# to avoid reemiting back to an above or current `<match>`
|
143
|
+
# We want to reemit messages to the **next** `<match>`
|
153
144
|
found_reemit = false
|
154
145
|
@matches.find do |m|
|
155
146
|
if m.match(tag)
|
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.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: 2017-09-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.6.13
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Fluentd plugin to re-emit messages avoiding infinity match loop
|