How to change Date format from YYYY-MM-DD to DD/MMM/YYYY


(Thiruvengadesh) #1

Hi,

To Monitor a application through logstash, i need to change format of data field from YYYY-MM-DD (2018-05-19) to DD/MMM/YYYY (19/May/2018) please suggest how to achive it.


#2
  mutate { add_field => { "[date1]" => "2018-05-19" } }
  ruby { code => "event.set('date2', Date.strptime(event.get('[date1]'), '%Y-%m-%d').strftime('%d/%b/%Y'))" }

does it. Error handling left as an exercise for the reader.


(system) #3

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