lib/fluent/mixin/plaintextformatter.rb in fluent-mixin-plaintextformatter-0.2.4 vs lib/fluent/mixin/plaintextformatter.rb in fluent-mixin-plaintextformatter-0.2.5
- old
+ new
@@ -5,10 +5,11 @@
module Mixin
module PlainTextFormatter
attr_accessor :output_include_time, :output_include_tag, :output_data_type
attr_accessor :add_newline, :field_separator
attr_accessor :remove_prefix, :default_tag
+ attr_accessor :null_value
attr_accessor :suppress_log_broken_string
attr_accessor :f_separator
@@ -44,10 +45,12 @@
if @default_tag.nil? or @default_tag.length < 1
raise Fluent::ConfigError, "Missing 'default_tag' with output_include_tag and remove_prefix."
end
end
+ @null_value = first_value( conf['null_value'], @null_value, 'NULL' )
+
# default timezone: utc
if not conf.has_key?('localtime') and not conf.has_key?('utc')
@localtime = false
elsif conf.has_key?('localtime')
@localtime = true
@@ -83,10 +86,10 @@
when 'ltsv'
LTSV.dump(record)
end
else
@custom_attributes.map{|attr|
- record[attr].nil? ? 'NULL' : record[attr].to_s
+ record[attr].nil? ? @null_value : record[attr].to_s
}.join(@f_separator)
end
end
def format(tag, time, record)