lib/fluent/plugin/out_grepcounter.rb in fluent-plugin-grepcounter-0.4.1 vs lib/fluent/plugin/out_grepcounter.rb in fluent-plugin-grepcounter-0.4.2
- old
+ new
@@ -17,11 +17,11 @@
config_param :less_equal, :float, :default => nil
config_param :greater_than, :float, :default => nil
config_param :greater_equal, :float, :default => nil
config_param :output_tag, :string, :default => nil # obsolete
config_param :tag, :string, :default => nil
- config_param :add_tag_prefix, :string, :default => 'count'
+ config_param :add_tag_prefix, :string, :default => nil
config_param :remove_tag_prefix, :string, :default => nil
config_param :output_with_joined_delimiter, :string, :default => nil # obsolete
config_param :delimiter, :string, :default => nil
config_param :aggregate, :string, :default => 'tag'
config_param :replace_invalid_sequence, :bool, :default => false
@@ -81,10 +81,14 @@
if (f.exist? && !f.writable_real?) || (!f.exist? && !f.parent.writable_real?)
raise Fluent::ConfigError, "#{@store_file} is not writable"
end
end
- @tag_prefix = "#{@add_tag_prefix}."
+ if @tag.nil? and @add_tag_prefix.nil? and @remove_tag_prefix.nil?
+ @add_tag_prefix = 'count' # not ConfigError to support lower version compatibility
+ end
+
+ @tag_prefix = "#{@add_tag_prefix}." if @add_tag_prefix
@tag_prefix_match = "#{@remove_tag_prefix}." if @remove_tag_prefix
@tag_proc =
if @tag
Proc.new {|tag| @tag }
elsif @tag_prefix and @tag_prefix_match