- offer more assistance if using a deprecated setting. If a plugin has:

config :whatever, :deprecated => "some message'
  then the deprecated warning will include that message
This commit is contained in:
Jordan Sissel 2013-09-06 18:49:12 -07:00
parent 74a6210b3b
commit 02851d76c2
3 changed files with 15 additions and 8 deletions

View file

@ -53,8 +53,15 @@ module LogStash::Config::Mixin
params.each do |name, value|
opts = self.class.get_config[name]
if opts && opts[:deprecated]
@logger.warn("Deprecated config item #{name.inspect} set " +
"in #{self.class.name}", :name => name, :plugin => self)
extra = opts[:deprecated].is_a?(String) ? opts[:deprecated] : ""
extra.gsub!("%PLUGIN%", self.class.config_name)
@logger.warn("You are using a deprecated config setting " +
"#{name.inspect} set in #{self.class.config_name}. " +
"Deprecated settings will continue to work, " +
"but are scheduled for removal from logstash " +
"in the future. #{extra} If you have any questions " +
"about this, please visit the #logstash channel " +
"on freenode irc.", :name => name, :plugin => self)
end
end

View file

@ -15,16 +15,16 @@ class LogStash::Filters::Base < LogStash::Plugin
# act on messages with the same type. See any input plugin's "type"
# attribute for more.
# Optional.
config :type, :validate => :string, :default => "", :deprecated => true
config :type, :validate => :string, :default => "", :deprecated => "You can achieve this same behavior with the new conditionals, like: `if [type] == \"sometype\" { %PLUGIN% { ... } }`."
# Only handle events with all/any (controlled by include_any config option) of these tags.
# Optional.
config :tags, :validate => :array, :default => [], :deprecated => true
config :tags, :validate => :array, :default => [], :deprecated => "You can achieve similar behavior with the new conditionals, like: `if \"sometag\" in [tags] { %PLUGIN% { ... } }`"
# Only handle events without all/any (controlled by exclude_any config
# option) of these tags.
# Optional.
config :exclude_tags, :validate => :array, :default => [], :deprecated => true
config :exclude_tags, :validate => :array, :default => [], :deprecated => "You can achieve similar behavior with the new conditionals, like: `if !(\"sometag\" in [tags]) { %PLUGIN% { ... } }`"
# If this filter is successful, add arbitrary tags to the event.
# Tags can be dynamic and include parts of the event using the %{field}

View file

@ -15,15 +15,15 @@ class LogStash::Outputs::Base < LogStash::Plugin
# act on messages with the same type. See any input plugin's "type"
# attribute for more.
# Optional.
config :type, :validate => :string, :default => "", :deprecated => true
config :type, :validate => :string, :default => "", :deprecated => "You can achieve this same behavior with the new conditionals, like: `if [type] == \"sometype\" { %PLUGIN% { ... } }`."
# Only handle events with all of these tags. Note that if you specify
# a type, the event must also match that type.
# Optional.
config :tags, :validate => :array, :default => [], :deprecated => true
config :tags, :validate => :array, :default => [], :deprecated => "You can achieve similar behavior with the new conditionals, like: `if \"sometag\" in [tags] { %PLUGIN% { ... } }`"
# Only handle events without any of these tags. Note this check is additional to type and tags.
config :exclude_tags, :validate => :array, :default => [], :deprecated => true
config :exclude_tags, :validate => :array, :default => [], :deprecated => "You can achieve similar behavior with the new conditionals, like: `if !(\"sometag\" in [tags]) { %PLUGIN% { ... } }`"
# The codec used for output data
config :codec, :validate => :codec, :default => "plain"