mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Merge pull request #706 from logstash/format-backwards-compat
Format backwards compat
This commit is contained in:
commit
824b51f6ca
2 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue