Change Date format from yyyy-MM-dd hh:mm:ss to yyyy-MM-dd

Hello there,

I am using logstash logstash-6.4.0.
I have mysql req_date column which format is yyyy-MM-dd hh:mm:ss. i want to change this format into yyyy-MM-dd.
Input (mysql req_date column): 2017-05-31 00:00:00.000
Expected in elastic search: 2017-05-31

filter {
if [type] == "response" {
date {
match => [ "req_date", "yyyy-MM-dd hh:mm:ss" ]
target => "log_day"
}
date_formatter {
source => "log_day"
pattern => "yyyy-MM-dd"
}
}
}

It gives the error:
"Couldn't find any filter plugin named 'date_formatter'.

please suggest.

Thanks.

I have never heard of a plugin named date_formatter. Where did you come across this?

All timestamps in Elasticsearch include a time component, so the formatted date would probably have to be mapped as a string. The log_day field will be converted into UTC timezone. Do you want the pure date based on the original value or the one in UTC?

Thanks for reply.

I found something about date_formatter on this post:

anyway, i have date column req_date: 2017-09-29T18:30:00.000Z.
i want 2017-09-29 in req_date date column. it should be date type. i want to remove timezone.

Thanks.

Dates are represented as timestamps in Elasticsearch, so will have a time component and must be in UTC timezone.

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