Convert timestamp field from yyyy-MM-dd HH:mm:ss to yyyy-MM-dd HH:mm:ss.SSS


(Carlos Madera) #1

Hello I have a logstash input from amazon kinesis than one field "news_timestamp" have an timestamp with this format "yyyy-MM-dd HH:mm:ss"

I need to update this field adding the milliseconds .000 like this "yyyy-MM-dd HH:mm:ss.SSS"

how I can do this, im using elasticsearch 6.x and logstash 6.x,

thanks for advance


(Magnus B├Ąck) #2

You can use a mutate filter to either

  • use gsub to substitute the end of the string ($) with ".000" or
  • use the replace option to set the field's value to "%{news_timestamp}.000".

(system) #3

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