fluent-plugin-records-merger 0.1.6 → 0.1.7

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
  SHA256:
3
- metadata.gz: 2cc61cda29562aa3584b286a76306f0aa056b7c03b7c2ea08873015e405dd1dd
4
- data.tar.gz: 5d05ec3251915b6b4718bd1f9e63e3ef8b889c18d8c40d3439be11acbc80b584
3
+ metadata.gz: d2dadccfda29fd7cd20e69f57e0470b53eb045b024bd02b88121fd077093b710
4
+ data.tar.gz: 4ed5c0798334c3ecc646adf1ab11bd437810586c352d08b58a761ae529050be7
5
5
  SHA512:
6
- metadata.gz: 52ff0bc07bae39d77757d6cd77c9ef9adf670692c53cf63740a7589e461977a606ab99828a2e37eb9f3411a346f3c572eaa011c67167dc1f3ecdbf43c2122f20
7
- data.tar.gz: bd1f34ec4086088e27a5bc4314049629d75ff48674779cf616c8b1c0b74c26757de0c220035cff854feb2d797f59b14411605080faa9cc8e735408e3da1c3c18
6
+ metadata.gz: 71807003aef31b0dd760ed69bd57ed4741d4628817f9982bfd7627869f6575c0434e7b75fa2b714b64301c76e16cb3291f129db4ef50fa03ce7676adbe0ffeae
7
+ data.tar.gz: eb474e704455ffbdc46dc6d8b2a9ef9487cd637d6cb8928c281712fde4548600b3eb94dc87324587e8023fb8b5ba031de58e184d87df52c9212e5def3f96e431
data/example/fluent.conf CHANGED
@@ -29,6 +29,19 @@
29
29
  </record>
30
30
  </match>
31
31
 
32
+ <match x.**>
33
+ @type records_merger
34
+ tag result
35
+ merge_timing before
36
+ main_tag x.main
37
+ sub_tag1 x.sub1
38
+ condition sub1 != nil
39
+ emit_first_main true
40
+ <record>
41
+ main ${main["word"]}
42
+ sub ${sub1["word"]}
43
+ </record>
44
+ </match>
32
45
 
33
46
  <match result>
34
47
  @type stdout
@@ -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.6'
8
+ spec.version = '0.1.7'
9
9
  spec.authors = ['Nobuyuki Oishi', 'WallyNegima']
10
10
  spec.email = ['u.str.gm@gmail.com']
11
11
 
@@ -43,6 +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 :emit_first_main, :bool, default: false, desc: 'emit only main if true'
46
47
  # 以下、未実装
47
48
  config_param :force_emit, :bool, default: false,
48
49
  desc: 'Specify to emit or not when exceeded the tolerable_time_range'
@@ -90,6 +91,7 @@ module Fluent
90
91
  @hostname = Socket.gethostname
91
92
  @condition = conf['condition']
92
93
  @keep_records = conf['keep_records']
94
+ @emit_first_main = conf['emit_first_main']
93
95
  end
94
96
 
95
97
  def start
@@ -107,6 +109,10 @@ module Fluent
107
109
  @flags4merge[0] = 1
108
110
  check_timegap if @tolerable_time_range > 0
109
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
110
116
  elsif @sub_tags.include?(tag)
111
117
  store_to_lastrecords(tag, es)
112
118
  @flags4merge[@sub_tags.index(tag) + 1] = 1
@@ -133,6 +139,10 @@ module Fluent
133
139
  @flags4merge[0] = 1
134
140
  check_timegap if @tolerable_time_range > 0
135
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
136
146
  elsif @sub_tags.include?(tag)
137
147
  store_to_lastrecords(tag, es)
138
148
  @flags4merge[@sub_tags.index(tag) + 1] = 1
@@ -222,7 +232,8 @@ module Fluent
222
232
 
223
233
  def condition_is_ok?(placeholder_values)
224
234
  placeholders = @placeholder_expander.prepare_placeholders(placeholder_values)
225
- instance_eval(@condition.gsub(/((main\["\w+"\])|(sub[0-9]{1,2}\["\w+"\]))/, 'placeholders[\'${\1}\']'))
235
+ pp @condition.gsub(/((main\["\w+"\])|(sub[0-9]{1,2}\["\w+"\])|(sub[0-9]{1,2})|main)/, 'placeholders[\'${\1}\']')
236
+ instance_eval(@condition.gsub(/((main\["\w+"\])|(sub[0-9]{1,2}\["\w+"\])|(sub[0-9]{1,2})|main)/, 'placeholders[\'${\1}\']'))
226
237
  end
227
238
 
228
239
  def check_timegap
data/release.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ git add lib/
4
+ git add fluent-plugin-records-merger.gemspec
5
+ git commit -m 'release commit'
6
+ gem build fluent-plugin-records-merger.gemspec
7
+ rake release
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-records-merger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nobuyuki Oishi
@@ -93,6 +93,7 @@ files:
93
93
  - example/word3.json
94
94
  - fluent-plugin-records-merger.gemspec
95
95
  - lib/fluent/plugin/out_records_merger.rb
96
+ - release.sh
96
97
  - test/helper.rb
97
98
  - test/plugin/test_out_records_merger.rb
98
99
  homepage: https://github.com/WallyNegima/fluent-plugin-records-merger