Convert string to date and change date format


#1

I am using JDBC input.

In my sql query craeteddate is a date field,When i am running logstash without any filter createddate field recognizing as date field.

But i don't want time in craeteddate,So applied ruby filter to convert my createddate format.After applying this filter createddate converted as string.

Example:
Createddate from Database August 25th 2017, 12:03:02.653
what i need : August 25th 2017

After this i applied date filter to convert createddate from string to date.

After this filter i am again getting time in createddate,But i dont want time in createddate.

Below are my filters

ruby {
        code => "event.set('createddate', event.get('[createddate]').time.strftime('%d-%m-%Y'))"
    }
date {
        match => ["createddate","dd-MM-yy"]
        target => "createddate"
   }

Please help me how can i get only date


(system) #2

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