mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Merge pull request #143 from logstash/LOGSTASH-474
fixing @type setting on json_event messages
This commit is contained in:
commit
2dc4ab17af
1 changed files with 5 additions and 0 deletions
|
@ -29,6 +29,10 @@ class LogStash::Inputs::Base < LogStash::Plugin
|
|||
# If format is "json", an event sprintf string to build what
|
||||
# the display @message should be given (defaults to the raw JSON).
|
||||
# sprintf format strings look like %{fieldname} or %{@metadata}.
|
||||
#
|
||||
# If format is "json_event", ALL fields except for @type
|
||||
# are expected to be present. Not receiving all fields
|
||||
# will cause unexpected results.
|
||||
config :message_format, :validate => :string
|
||||
|
||||
# Add any number of arbitrary tags to your event.
|
||||
|
@ -101,6 +105,7 @@ class LogStash::Inputs::Base < LogStash::Plugin
|
|||
when "json_event"
|
||||
begin
|
||||
event = LogStash::Event.from_json(raw)
|
||||
event.type ||= @type
|
||||
rescue => e
|
||||
## TODO(sissel): Instead of dropping the event, should we treat it as
|
||||
## plain text and try to do the best we can with it?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue