fluent-mixin-plaintextformatter 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/fluent-mixin-plaintextformatter.gemspec +1 -1
- data/lib/fluent/mixin/plaintextformatter.rb +4 -1
- data/test/mixin/test_plaintextformatter.rb +29 -0
- 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: c7580967d97e92a5898d818ebdc023e4ee64abcc
|
4
|
+
data.tar.gz: a1f8aa1a8d94d56b0ca8d19f845fe6abc28c5724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 921894b09e85ee4765173f072ef6fc9643e296cb1c76dd7a7f6e0ff1b2f085177b68ac6d7b3ee0daf12fc530dd8ddc5f0ff62573d83a0c1378f348ca6c89307a
|
7
|
+
data.tar.gz: 4cd1a15ddad15d57a62631b8af51d580cd61dc75b6d655bd0dedd7fc194f3bdd091f3ff676d55d95edddd52c264b4970e9974e586f174adcac8455de50ecb292
|
data/README.md
CHANGED
@@ -61,6 +61,7 @@ And you can overwrite default formatting configurations on your plugin (values b
|
|
61
61
|
config_set_default :time_format, nil # nil means ISO8601 '2012-07-13T19:29:49+09:00'
|
62
62
|
config_set_default :remove_prefix, nil
|
63
63
|
config_set_default :default_tag, nil
|
64
|
+
config_set_default :null_value, 'NULL'
|
64
65
|
|
65
66
|
# ...
|
66
67
|
end
|
@@ -80,6 +81,8 @@ Provided configurations are below:
|
|
80
81
|
* remove_prefix
|
81
82
|
* input tag 'test.foo' with 'remove_prefix test', output tag is 'foo'.
|
82
83
|
* 'default\_tag' configuration is used when input tag is completely equal to 'remove\_prefix'
|
84
|
+
* null_value
|
85
|
+
* output value if value is null(nil). default is 'NULL'.
|
83
86
|
|
84
87
|
## AUTHOR / CONTRIBUTORS
|
85
88
|
|
@@ -87,6 +90,7 @@ Provided configurations are below:
|
|
87
90
|
* TAGOMORI Satoshi <tagomoris@gmail.com>
|
88
91
|
* CONTRIBUTORS
|
89
92
|
* wolfg1969 https://github.com/wolfg1969
|
93
|
+
* Shinya Okano <tokibito@gmail.com>
|
90
94
|
|
91
95
|
## LICENSE
|
92
96
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "fluent-mixin-plaintextformatter"
|
4
|
-
gem.version = "0.2.
|
4
|
+
gem.version = "0.2.5"
|
5
5
|
gem.authors = ["TAGOMORI Satoshi"]
|
6
6
|
gem.email = ["tagomoris@gmail.com"]
|
7
7
|
gem.description = %q{included to format values into json, tsv or csv}
|
@@ -7,6 +7,7 @@ module Fluent
|
|
7
7
|
attr_accessor :output_include_time, :output_include_tag, :output_data_type
|
8
8
|
attr_accessor :add_newline, :field_separator
|
9
9
|
attr_accessor :remove_prefix, :default_tag
|
10
|
+
attr_accessor :null_value
|
10
11
|
|
11
12
|
attr_accessor :suppress_log_broken_string
|
12
13
|
|
@@ -46,6 +47,8 @@ module Fluent
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
@null_value = first_value( conf['null_value'], @null_value, 'NULL' )
|
51
|
+
|
49
52
|
# default timezone: utc
|
50
53
|
if not conf.has_key?('localtime') and not conf.has_key?('utc')
|
51
54
|
@localtime = false
|
@@ -85,7 +88,7 @@ module Fluent
|
|
85
88
|
end
|
86
89
|
else
|
87
90
|
@custom_attributes.map{|attr|
|
88
|
-
record[attr].nil? ?
|
91
|
+
record[attr].nil? ? @null_value : record[attr].to_s
|
89
92
|
}.join(@f_separator)
|
90
93
|
end
|
91
94
|
end
|
@@ -289,4 +289,33 @@ output_data_type attr:foo,bar
|
|
289
289
|
# format
|
290
290
|
assert_equal "2012-07-13T07:05:05Z\ttest.a\ttrue\tfalse\n", p.format('test.a', 1342163105, r)
|
291
291
|
end
|
292
|
+
|
293
|
+
def test_null_value_default
|
294
|
+
p = create_plugin_instance(Fluent::TestAOutput, %[
|
295
|
+
type testa
|
296
|
+
output_include_time false
|
297
|
+
output_include_tag false
|
298
|
+
output_data_type attr:foo
|
299
|
+
])
|
300
|
+
r = {'foo' => nil}
|
301
|
+
# stringify
|
302
|
+
assert_equal "NULL", p.stringify_record(r)
|
303
|
+
# format
|
304
|
+
assert_equal "NULL\n", p.format('test.a', 1342163105, r)
|
305
|
+
end
|
306
|
+
|
307
|
+
def test_null_value_custom
|
308
|
+
p = create_plugin_instance(Fluent::TestAOutput, %[
|
309
|
+
type testa
|
310
|
+
output_include_time false
|
311
|
+
output_include_tag false
|
312
|
+
output_data_type attr:foo
|
313
|
+
null_value \\N
|
314
|
+
])
|
315
|
+
r = {'foo' => nil}
|
316
|
+
# stringify
|
317
|
+
assert_equal "\\N", p.stringify_record(r)
|
318
|
+
# format
|
319
|
+
assert_equal "\\N\n", p.format('test.a', 1342163105, r)
|
320
|
+
end
|
292
321
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-mixin-plaintextformatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|