Date parsing failure error

Hello there,

I am getting dateparsingfailure error when running logstash-6.4.0.

This is my database column and its values
sno		reference_id   dateofbirth		 post_date
7979     2671254433  	 1990-01-31	     2017-01-19 10:22:53

Config file:
input {
jdbc {
jdbc_connection_string => "jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull"
jdbc_user => "root"
jdbc_password => "mysql"
jdbc_driver_library => "C:\mysql-connector-java-8.0.13.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
statement => "select sno, reference_id, dateofbirth, post_date from testdb.sample"
type => "response"
}
}
filter {
if [type] == "response" {
date {
match => ["dateofbirth","YYYY-MM-dd"]
timezone=> "Asia/Kolkata"
target => "dateofbirth"
}
date {
match => ["post_date","YYYY-MM-dd HH:mm:ss"]
timezone=> "Asia/Kolkata"
target => "post_date"
}
}
}
output {
if [type] == "response" {
elasticsearch {
index => "sample_index"
document_id => "%{reference_id}"
hosts => "localhost:9200"
}
stdout {
codec => rubydebug
}
}
}

this is the response:
{
"tags" => [
[0] "_dateparsefailure"
],
"post_date" => 2017-01-19T10:22:53.000Z,
"dateofbirth" => 1990-01-31T18:30:00.000Z,
"@version" => "1",
"reference_id" => "2671254433",
"@timestamp" => 2019-02-20T12:25:30.623Z,
"sno" => 7979,
"type" => "response"
}

Please suggest.
Thanks.

I suspect, given that post_date does not get moved to a different timezone, that post_date is being returned as a timestamp from the database, so a date filter cannot parse it. Can you try just commenting out the second date filter?

Thanks for reply.
It is giving the same error when i comment second date filter (post_date).

Actually it is possible the same is true of the first date filter. You may not need any date filters at all.

Thanks for reply.

I have run after commented the date filters. but now, it increases timestamp value.
for example: my database value is: '2014-12-15 10:30:33'
and in elastic search it is showing: "2014-12-15T05:00:33.000Z"

Perhaps the jdbc_default_timezone option would help?

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