Hi Team,
I have following logstash configuration for where I have written the date pattern to parse my timestamp, but time is not working. I'm getting _dateparsefailure.
here is the configuration.
input{.............}
filter {
..............
.........
if[time] {
date {
match => ["time", "yyyy-MM-dd HH:mm:ss,SSS", "yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss ,SSS"]
target => "@timestamp"
locale => "en"
timezone => "+04:00"
}
mutate {
add_field => { "log" => "%{time} %{message}" }
remove_field => ["kafkatime","message1","message"]
}
}
else {
mutate {
add_field => { "log" => "%{message}" }
remove_field => ["kafkatime","message1","message","time"]
}
}
...................
..............
output {.................}
This is my time coming in logs
"log"=>"2022-07-15 09:20:20,157 | tid:0ofq198rsnX3ziJ4Q92xsNZ-b2M|
Below is my failure message:
"error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [time] of type [date] in document with id 'obBnAIIBgI2nnIQahxqE'. Preview of field's value: '2022-07-15 09:20:20,157'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to parse date field [2022-07-15 09:20:20,157] with format [strict_date_optional_time||epoch_millis]", "caused_by"=>{"type"=>"date_time_parse_exception", "reason"=>"date_time_parse_exception: Failed to parse with all enclosed parsers"}}}}}}
Kindly help me to troubleshoot this.
Thanks,
Tahseen