Search code examples
elasticsearchlogstashlogstash-configuration

Timestamp to date in Logstash


I am trying to convert a string field called timestamp with value 1510722000000 in date format field in Logstash. My sole purpose is to visualize data in kibana using this date field. I tried using the date filter but it does not create the target field for me. Can anyone tell me How can I achieve this

My date filter looks like this

date {
    timezone => "UTC"
    match => ["timestamp", "UNIX_MS"]
    target => "@timestamp1"
}

Solution

  • The Date filter used by me is correct. The problem is my input from timestamp is an array of milliseconds from epoch time. Date filter cannot convert an array of values in date field. To parse the values in array we can use Ruby filter.

    Take a look on this post Parsing array of epoch time values in Ruby filter

    please note it will still not convert into datefield format but just parse the values.