- add deprecation message for the 'format' setting

- correctly load the codecs for format's setting
This commit is contained in:
Jordan Sissel 2013-10-08 07:15:42 -07:00
parent 939817dd6c
commit 42b5e8dc31

View file

@ -31,7 +31,7 @@ class LogStash::Inputs::Base < LogStash::Plugin
config :debug, :validate => :boolean, :default => false
# The format of input data (plain, json, json_event)
config :format, :validate => ["plain", "json", "json_event", "msgpack_event"], :deprecated => true
config :format, :validate => ["plain", "json", "json_event", "msgpack_event"], :deprecated => "You should use the newer 'codec' setting instead."
# The codec used for input data
config :codec, :validate => :codec, :default => "plain"
@ -84,8 +84,10 @@ class LogStash::Inputs::Base < LogStash::Plugin
# Backwards compat for the 'format' setting
case @format
when "plain"; # do nothing
when "json"; @codec = LogStash::Codecs::JSON.new
when "json_event"; @codec = LogStash::Codecs::OldLogStashJSON.new
when "json"
@codec = LogStash::Plugin.lookup("codec", "json").new
when "json_event"
@codec = LogStash::Plugin.lookup("codec", "oldlogstashjson").new
end
end # def initialize