Logstash time stamp error

my logstash in utc time zone.
when it is loading data timestamp is in below format
"@timestamp" => "2017-02-17T05:17:51.289Z",

but when i am just extracting date from @timestamp field with a ruby code as below
tstamp = event['@timestamp'].to_i
event['date']=Time.at(tstamp).strftime('%Y-%m-%d')

it should give me 2017-02-17 but it is giving me the 2017-02-16 date..
not able to figure out why?

"date" => "2017-02-16"

It seems Ruby's Time class uses the local timezone by default. Perhaps you can use its getutc method to get a UTC timestamp?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.