mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- set @timestamp field correctly
This commit is contained in:
parent
b5a71c9ce6
commit
10e42a6c88
1 changed files with 3 additions and 1 deletions
|
@ -11,13 +11,15 @@ class LogStash::Codecs::OldLogStashJSON < LogStash::Codecs::Base
|
|||
h = {}
|
||||
|
||||
# Convert the old logstash schema to the new one.
|
||||
basics = %w(@timestamp @message @source_host @source_path @source
|
||||
basics = %w(@message @source_host @source_path @source
|
||||
@tags @type)
|
||||
basics.each do |key|
|
||||
# Convert '@message' to 'message', etc
|
||||
h[key[1..-1]] = obj[key] if obj.include?(key)
|
||||
end
|
||||
|
||||
h["@timestamp"] = obj["@timestamp"] if obj.include?("@timestamp")
|
||||
|
||||
h.merge!(obj["@fields"]) if obj["@fields"].is_a?(Hash)
|
||||
yield LogStash::Event.new(h)
|
||||
end # def decode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue