diff --git a/VERSION b/VERSION index bcab45a..81340c7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.3 +0.0.4 diff --git a/lib/fluent/plugin/filter_flatten.rb b/lib/fluent/plugin/filter_flatten.rb index 69100ab..96819c8 100644 --- a/lib/fluent/plugin/filter_flatten.rb +++ b/lib/fluent/plugin/filter_flatten.rb @@ -40,10 +40,18 @@ def filter(tag, time, record) end def flatten(record) + unless @field.to_s.length > 0 + raise Fluent::ConfigError, "Invalid invocation: field not defined" + end + newrecord = {} record.each do |key, value| - newkey = key.gsub(/\./, @separator) + if key.match(@field) + newkey = key.gsub(/\./, @separator) + else + newkey = key + end # Recurse hashes and arrays: if @recurse