Merge pull request #706 from logstash/format-backwards-compat

Format backwards compat
This commit is contained in:
Jordan Sissel 2013-10-08 07:17:24 -07:00
commit 824b51f6ca
2 changed files with 11 additions and 2 deletions

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"
@ -81,6 +81,15 @@ class LogStash::Inputs::Base < LogStash::Plugin
@codec.instance_eval { @charset = charset }
end
# Backwards compat for the 'format' setting
case @format
when "plain"; # do nothing
when "json"
@codec = LogStash::Plugin.lookup("codec", "json").new
when "json_event"
@codec = LogStash::Plugin.lookup("codec", "oldlogstashjson").new
end
end # def initialize
public

View file

@ -145,7 +145,7 @@ RUBY_ENGINE == "jruby" and describe LogStash::Filters::Date do
'{ "mydate": "this will not parse" }',
'{ }'
]
format => json_event
codec => json
type => foo
count => 1
}