Yesterday i cam across something i can't understand.
Let's say i stopped my logstash at 10 AM and put it back on at 12, usually logs are coming and re-ordered as normal ( i can't figure how since @timestamp field should be ingest time ). As normal i mean it's near their creation time and everything is put back in the timeline.
Yesterday my pattern had a conflict or missing field and when i started my logstash every logs were spiking and @timestamp at the time i started my logstash thus creating a false timeline.
I tried to reproduce it but it looks like i am missing some pieces of informations.
My logs are shipped through filebeat to logstash then elastic.
Set mapping to type and format date to try to replace @timestamp in the pattern with event.created time or something more accurate to keep track of the event timeline.
PUT index
{
"mappings": {
"properties": {
"datedate": {
"type": "date" ,
"format": "YYYY MM DD HH:mm:ss"
}
}
}
}
Combining this to a logstash filter with the correct date format :
mutate {
add_field => { "datedate" => "2020 10 07 16:01:01" }
}
date {
match => [ "datedate", "YYYY MM dd HH:mm:ss" ]
}
Seemed to work but my Kibana refused to understand the first part of the year depsite the configuration of the date format of kibana in the settings ( note that "dd" in logstash is not "dd" in Kibana )
The original field in my doc is still shown as 2020 10 07 but Kibana created another from the pattern i believe with another value.
I dont know how all this works and i'd like to find answers on how the @timestamp field behave and how can we improve our configuration.
From what i've always understand @timestamp is from the ingestion time but i've seen it re-ordering logs in the correct time after a production crash or something.
By default, logstash adds the @timestamp field with the current time (i.e. when it is ingested). The date filter will overwrite this with whatever it parses. @timestamp is always in UTC, so if you are two hours ahead of UTC a date filter will convert "2020 10 07 16:01:01" to 2020-10-07T14:01:01.000Z
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.