# Failed parsing date from field creation\_date (jdbc)

**URL:** <https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244>\
**Category:** Logstash\
**Created:** [April 13, 2016, 12:14pm UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244 "2016-04-13T12:14:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![PascalR](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@PascalR](https://discuss.elastic.co/u/PascalR)\
**Post date:** [April 13, 2016, 12:14pm UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/1 "2016-04-13T12:14:56Z")

</div>

Hi,  
I tried to load data from my MySQL database to ES. It worked well, only fields with datetime have a wrong time in it.  
As you can see in the config-file below, I used a date filter to solve this with several formats, but it's giving me the exception:

**"←[33mFailed parsing date from field {:field=\>"creation\_date", :value=\>"2014-05-21T12:19:32.000Z", :exception=\>"cannot convert instance of class org.jruby.RubyObject to class java.lang.String", :config\_parsers=\>"ISO8601,yyyy-MM-dd**  
**HH:mm:ss", :config\_locale=\>"en", :level=\>:warn}←[0m"**

Any idea what's the problem here?

Thanks.

# file:db.conf

> input {  
> jdbc {  
> #MySQL jdbc connection string to our database, XY  
> jdbc\_connection\_string =\> "jdbc:mysql://XY"
> 
> #The user we wish to execute our statement as  
> jdbc\_user =\> XY
> 
> #The user password  
> jdbc\_password =\> XY
> 
> #The path to our downloaded jdbc driver  
> jdbc\_driver\_library =\> "C:\ES\_b\_dev\2016\_04\_04\elasticsearch-jdbc-2.3.1.0\lib\mysql-connector-java-5.1.38.jar"
> 
> #The name of the driver class for MySQL  
> jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"
> 
> #Our query  
> statement =\> XY  
> }  
> }

> filter {  
> date {  
> timezone =\> "Europe/Berlin"  
> match =\> ["creation\_date" , "ISO8601", "yyyy-MM-dd HH:mm:ss"]  
> #match =\> ["preset\_start\_date" , "yyyy-MM-dd HH:mm:ss"], "yyyy-MM-ddTHH:mm:ss.SSSZ"  
> #match =\> ["preset\_start\_time" , "yyyy-MM-dd HH:mm:ss"]  
> #match =\> ["start\_time" , "yyyy-MM-dd HH:mm:ss"]  
> #match =\> ["end\_time" , "yyyy-MM-dd HH:mm:ss"]  
> #timezone =\> "UTC"  
> #target =\> "creation\_date"  
> }  
> }

> output {  
> #stdout { codec =\> json\_lines }  
> elasticsearch {  
> #protocol =\> http  
> index =\> "XY"  
> document\_type =\> "XY"  
> document\_id =\> "%{XY}"  
> hosts =\> "localhost"  
> }  
> }

---

<div class="post-metadata">

**Author:** ![mick66](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@mick66](https://discuss.elastic.co/u/mick66)\
**Post date:** [April 14, 2016, 9:12am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/2 "2016-04-14T09:12:44Z")

</div>

Try converting the date to a string before your date filter:

```
mutate {
     convert => ["creation_date", "string"]
 }

date {
    timezone => "Europe/Berlin"
    match => ["creation_date" , "ISO8601", "yyyy-MM-dd HH:mm:ss"]
}
```

---

<div class="post-metadata">

**Author:** ![PascalR](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@PascalR](https://discuss.elastic.co/u/PascalR)\
**Post date:** [April 14, 2016, 9:32am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/3 "2016-04-14T09:32:40Z")

</div>

Thanks for you answer.

The error is gone but the time is still wrong.

The field in my database says **2012-07-17 08:00:36** and in my elasticsearch document it says **2012-07-17T06:00:36.000Z**

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 18, 2016, 5:55pm UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/4 "2016-04-18T17:55:42Z")

</div>

That's expected. ES stores timestamps in UTC and Berlin is two hours ahead of UTC during July.

---

<div class="post-metadata">

**Author:** ![PascalR](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@PascalR](https://discuss.elastic.co/u/PascalR)\
**Post date:** [April 20, 2016, 8:46am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/5 "2016-04-20T08:46:26Z")

</div>

So I have to change my timezone in the presentation layer?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 20, 2016, 9:30am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/6 "2016-04-20T09:30:46Z")

</div>

Exactly.

---

<div class="post-metadata">

**Author:** ![PascalR](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@PascalR](https://discuss.elastic.co/u/PascalR)\
**Post date:** [April 20, 2016, 10:10am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/7 "2016-04-20T10:10:40Z")

</div>

Thanks!

I've also have a problem with indexing multiple sql tables in one config file. Should I open a new thread or can we continue here?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 20, 2016, 11:06am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/8 "2016-04-20T11:06:14Z")

</div>

It sounds like a different question so I suggest a new thread.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:01am UTC](https://discuss.elastic.co/t/failed-parsing-date-from-field-creation-date-jdbc/47244/9 "2017-07-06T05:01:28Z")

</div>


