Changing Date Format in logstash

How can i delete the t and z date format in elastic search using through logstash.

my input is :2017-05-08 07:27:03.121 after push into elastic search its shows like 2017-05-08T07:27:03.121Z
format ,how can i remove the T and Z in time format while push into elastic using logstash.

Excepted output is :2017-05-08 07:27:03.121

The output format of the date filter isn't configurable. If you really want to produce a timestamp in a different format you can use a ruby filter.

I think you're spending your time on the wrong problem. The raw value should never be displayed to users and the current format is a standard format that's unambiguous and that any piece of software can parse. Both the T and the Z are there for a reason. In fact, removing the Z without adjusting the rest of the timestamp would make it incorrect unless the local timezone happent to be GMT.

Yeah, thank you!!! But I am facing problem when retrieving it through java using Jest client. What is the timestamp format we have to use in java to retrieve time stamp from elastic search.

You mean how to turn the string 2017-05-08T07:27:03.121Z into e.g. a java.util.Date object? I don't know, look for an ISO8601 parser.

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