event_v1 to_json/from_json timestamp mangling

Description

Two problems handling timestamps in event_v1.rb...

First, when serializing an event to json, the monkey patched Time.to_json method (event_v1.rb:9-14) is not used at all. This causes the resulting json to lose sub-second precision.

Second, when unserializing and event from json, the @timestamp field is not parsed into a Time object, but left as a string. Logstash expects to find a time object there, so this causes exceptions down the line (for example in stdout output or anywhere %{+format} is used).

Environment

None

Status

Assignee

Logstash Developers

Reporter

louis z

Labels

None

Fix versions

Priority

Configure