I have log format as
2021-10-04 14:20:27,552 ---
and I want field in Elasticsearch as date type
but i am getting string type
my logstash config file is
You need to set the mapping as a date. If you look at it right now it probably is a text/keyword based off being the default and not setting the mapping prior to ingest.
GET localtest/_mapping to see what you currently have.
You can't change the mapping so you need to either delete your index, set the mapping, and then reingest the data. Or you can reindex to a temp index and then reindex back to original.
i don't know how date filter works I just want date and time from log file as date type field so that I can use to create visualization as line chart at x axis date and time
I should have get field time_stamp as date type not string
date{
match => ["time_stamp" , "yyyy-MM-dd HH:mm:ss,SSS"]
}
What this is doing is setting a field in your index called @timestamp using the values of time_stamp. Then you no longer need the field time_stamp unless you need it for another reason.
If you have not already done this then you need to create an index pattern and when you get to the option to select a field for timeseries select the @timestamp.
Now when you create visualizations you can use that field for your purpose.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.