fluent-plugin-records-merger 0.1.7 → 0.1.8
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/example/fluent.conf +2 -2
- data/fluent-plugin-records-merger.gemspec +1 -1
- data/lib/fluent/plugin/out_records_merger.rb +10 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 999fed03b4998d377be392beda7a0892bcbb4e3fa6247987c2b587df05f47c88
|
4
|
+
data.tar.gz: e842393261b9a5303dd01b88286b4b3da7349dbf2fd12ec27d1b5be7b57fea22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebbb22edfc69e638a6f94f3c9118e5a6b898ae4e6a70ac2f2eef5a67e23294324403c8075123217ca2c8cbf99fac90f6bd9f2bf3b4956a1876529bc6c638e80d
|
7
|
+
data.tar.gz: 9dd9e2fe5bbc9765a00a835e8649c32a8e221c220890fdcb75331ba8f7bb0974057af3d8051bc16fe68283dbea736e876fca80f125abbc3c4e1d4d910b34e7d5
|
data/example/fluent.conf
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'fluent-plugin-records-merger'
|
8
|
-
spec.version = '0.1.
|
8
|
+
spec.version = '0.1.8'
|
9
9
|
spec.authors = ['Nobuyuki Oishi', 'WallyNegima']
|
10
10
|
spec.email = ['u.str.gm@gmail.com']
|
11
11
|
|
@@ -43,7 +43,7 @@ module Fluent
|
|
43
43
|
|
44
44
|
config_param :condition, :string, default: nil, desc: 'emit if condition is true '
|
45
45
|
config_param :keep_records, :bool, default: false, desc: 'keep latest records if true'
|
46
|
-
config_param :
|
46
|
+
config_param :sub_is_must, :bool, default: true, desc: 'emit only main if true'
|
47
47
|
# 以下、未実装
|
48
48
|
config_param :force_emit, :bool, default: false,
|
49
49
|
desc: 'Specify to emit or not when exceeded the tolerable_time_range'
|
@@ -91,7 +91,11 @@ module Fluent
|
|
91
91
|
@hostname = Socket.gethostname
|
92
92
|
@condition = conf['condition']
|
93
93
|
@keep_records = conf['keep_records']
|
94
|
-
|
94
|
+
if conf['sub_is_must'] == "false"
|
95
|
+
@sub_is_must = false
|
96
|
+
else
|
97
|
+
@sub_is_must = true
|
98
|
+
end
|
95
99
|
end
|
96
100
|
|
97
101
|
def start
|
@@ -108,11 +112,7 @@ module Fluent
|
|
108
112
|
store_to_lastrecords(tag, es)
|
109
113
|
@flags4merge[0] = 1
|
110
114
|
check_timegap if @tolerable_time_range > 0
|
111
|
-
emit_new_event(es) if @flags4merge.all? { |flag| flag == 1 }
|
112
|
-
if @emit_first_main
|
113
|
-
emit_new_event(es)
|
114
|
-
@emit_first_main = false
|
115
|
-
end
|
115
|
+
emit_new_event(es) if (@flags4merge.all? { |flag| flag == 1 } || @sub_is_must == false)
|
116
116
|
elsif @sub_tags.include?(tag)
|
117
117
|
store_to_lastrecords(tag, es)
|
118
118
|
@flags4merge[@sub_tags.index(tag) + 1] = 1
|
@@ -128,7 +128,7 @@ module Fluent
|
|
128
128
|
store_to_lastrecords(tag, es)
|
129
129
|
@flags4merge[@sub_tags.index(tag) + 1] = 1
|
130
130
|
check_timegap if @tolerable_time_range > 0
|
131
|
-
emit_new_event(es) if @flags4merge.all? {|flag| flag == 1}
|
131
|
+
emit_new_event(es) if (@flags4merge.all? {|flag| flag == 1} || @sub_is_must == false)
|
132
132
|
end
|
133
133
|
else
|
134
134
|
p 'something else has come! check it!' + tag.to_s
|
@@ -138,16 +138,12 @@ module Fluent
|
|
138
138
|
store_to_lastrecords(tag, es)
|
139
139
|
@flags4merge[0] = 1
|
140
140
|
check_timegap if @tolerable_time_range > 0
|
141
|
-
emit_new_event(es) if @flags4merge.all? { |flag| flag == 1 }
|
142
|
-
if @emit_first_main
|
143
|
-
emit_new_event(es)
|
144
|
-
@emit_first_main = false
|
145
|
-
end
|
141
|
+
emit_new_event(es) if (@flags4merge.all? { |flag| flag == 1 } || @sub_is_must == false)
|
146
142
|
elsif @sub_tags.include?(tag)
|
147
143
|
store_to_lastrecords(tag, es)
|
148
144
|
@flags4merge[@sub_tags.index(tag) + 1] = 1
|
149
145
|
check_timegap if @tolerable_time_range > 0
|
150
|
-
emit_new_event(es) if @flags4merge.all? { |flag| flag == 1 }
|
146
|
+
emit_new_event(es) if (@flags4merge.all? { |flag| flag == 1 } || @sub_is_must == false)
|
151
147
|
else
|
152
148
|
p 'something else has come! check it!' + tag.to_s
|
153
149
|
end
|
@@ -232,7 +228,6 @@ module Fluent
|
|
232
228
|
|
233
229
|
def condition_is_ok?(placeholder_values)
|
234
230
|
placeholders = @placeholder_expander.prepare_placeholders(placeholder_values)
|
235
|
-
pp @condition.gsub(/((main\["\w+"\])|(sub[0-9]{1,2}\["\w+"\])|(sub[0-9]{1,2})|main)/, 'placeholders[\'${\1}\']')
|
236
231
|
instance_eval(@condition.gsub(/((main\["\w+"\])|(sub[0-9]{1,2}\["\w+"\])|(sub[0-9]{1,2})|main)/, 'placeholders[\'${\1}\']'))
|
237
232
|
end
|
238
233
|
|