fluent-plugin-record-reformer 0.5.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +7 -1
- data/fluent-plugin-record-reformer.gemspec +1 -1
- data/lib/fluent/plugin/out_record_reformer.rb +1 -1
- data/test/test_out_record_reformer.rb +31 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b11c53c3848c8e1f62cb8edbf0791b6d8da44fcc
|
4
|
+
data.tar.gz: 9d898ccdf04a40be27a8308545fa8c3da2df7a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38295f7e65940410aa78551dca912f0cbc40d3eff113fd685face34edd6cad5210d6492316b1fddb33ad80296fb0905bad7032173f2754c2bc941df8a642ff8
|
7
|
+
data.tar.gz: 54452db122efb3d69883095aef369d2ed13fc0901c259b0d92cff14c1af6af97ca939a048f03697f8a17c682a447ae545244231599186a85523aa1f6ecec10c7
|
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-record-reformer"
|
6
|
-
gem.version = "0.
|
6
|
+
gem.version = "0.6.0"
|
7
7
|
gem.authors = ["Naotoshi Seo"]
|
8
8
|
gem.email = "sonots@gmail.com"
|
9
9
|
gem.homepage = "https://github.com/sonots/fluent-plugin-record-reformer"
|
@@ -185,7 +185,7 @@ module Fluent
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def expand(str)
|
188
|
-
str.gsub(/(\${[
|
188
|
+
str.gsub(/(\${[^}]+}|__[A-Z_]+__)/) {
|
189
189
|
log.warn "record_reformer: unknown placeholder `#{$1}` found" unless @placeholders.include?($1)
|
190
190
|
@placeholders[$1]
|
191
191
|
}
|
@@ -161,7 +161,7 @@ class RecordReformerOutputTest < Test::Unit::TestCase
|
|
161
161
|
emits = emit(config, use_v1, msgs)
|
162
162
|
emits.each_with_index do |(tag, time, record), i|
|
163
163
|
assert_equal("reformed.#{@tag}", tag)
|
164
|
-
assert_equal("#{@hostname}
|
164
|
+
assert_equal("#{@hostname} ", record['message'])
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
@@ -385,6 +385,36 @@ class RecordReformerOutputTest < Test::Unit::TestCase
|
|
385
385
|
# nil tag message should not be emitted
|
386
386
|
assert_equal 0, d.emits.size
|
387
387
|
end
|
388
|
+
|
389
|
+
test 'expand fields starting with @ (enable_ruby no)' do
|
390
|
+
config = %[
|
391
|
+
tag tag
|
392
|
+
enable_ruby no
|
393
|
+
<record>
|
394
|
+
foo ${@timestamp}
|
395
|
+
</record>
|
396
|
+
]
|
397
|
+
d = create_driver(config, use_v1)
|
398
|
+
message = {"@timestamp" => "foo"}
|
399
|
+
d.run { d.emit(message, @time) }
|
400
|
+
reformed = d.emits.first[2]
|
401
|
+
assert_equal reformed["foo"], message["@timestamp"]
|
402
|
+
end
|
403
|
+
|
404
|
+
test 'expand fields starting with @ (enable_ruby yes)' do
|
405
|
+
config = %[
|
406
|
+
tag tag
|
407
|
+
enable_ruby yes
|
408
|
+
<record>
|
409
|
+
foo ${__send__("@timestamp")}
|
410
|
+
</record>
|
411
|
+
]
|
412
|
+
d = create_driver(config, use_v1)
|
413
|
+
message = {"@timestamp" => "foo"}
|
414
|
+
d.run { d.emit(message, @time) }
|
415
|
+
reformed = d.emits.first[2]
|
416
|
+
assert_equal reformed["foo"], message["@timestamp"]
|
417
|
+
end
|
388
418
|
end
|
389
419
|
end
|
390
420
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-record-reformer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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: 2015-
|
11
|
+
date: 2015-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|