I want to know how can I change the format of @timestamp while exporting from elasticsearch to csv via logstash. In Kibana I have kept the format as "Feb-03-2021 20:03:04.603" using advance settings. I want same format in csv as well. I have kept following filter in logstash which is unfortunately not working.
match => [ "@timestamp", "MMM-dd-yyyy HH:mm:ss.SSS" ]
Currently I am getting date as "2021-02-03T12:30:00.315Z" in csv.
If you want to reformat a Logstash::Timestamp then use a ruby filter and strftime.
code => "event.set('@timestamp' , event.get('@timestamp').time.strftime('%b-%d-%Y %H:%M:%S.%L'))"
I tried this and got rubyexception. Can you please tell me the correct way?
There is an example here.
I tried that, will it change the original @timestamp format? Or I have to add some new field??
Here is what I have tried:
code => '
t = Time.at(event.get("@timestamp").to_f)
I am still getting rubyexception.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.