Convert epoch time to date

[Edited] I am using Logstash 7.x version
I have log like below where scheduledTime is in epoch long number,
{"scheduledTime":1580634058274,"processTime":1580634073293,"mailingType":1,"userId":123}

I want it to be indexed to ES in below format through logstash
{"scheduledTime":"Wed Mar 11 2020 14:08:11","processTime":1580634073293,"mailingType":1,"userId":123}

You can use a date filter to convert an epoch time into a LogStash::Timestamp, then use ruby and strftime to convert it into a string in whatever format you want.

Thank you Badger, below works for me.
date {
match => [ "scheduledTime","UNIX_MS" ]
target => "scheduledTime"
timezone => "UTC"
}

1 Like

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