# Logstash : failed to parse field \[@timestamp\] of type \[date\]

**URL:** https://discuss.elastic.co/t/logstash-failed-to-parse-field-timestamp-of-type-date/190789
**Category:** Logstash
**Created:** [July 16, 2019, 4:12pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-field-timestamp-of-type-date/190789 "2019-07-16T16:12:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sandeep\_Bind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_bind/32/47746_2.png) [@Sandeep\_Bind](https://discuss.elastic.co/u/Sandeep_Bind)
#### Post date: [July 16, 2019, 4:12pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-field-timestamp-of-type-date/190789/1 "2019-07-16T16:12:53Z")

</div>

This is my logstash.conf file. I am trying to read the data from mysql database and send it to elastic search. I am getting below error.

This is my index creation command :  
curl -X POST -H "Content-Type: application/json" "[http://localhost:9200/vm-mysql/\_doc](http://localhost:9200/vm-mysql/_doc)" -d '{"@timestamp": '1561310406', "data-source": "MYSQL", "assetname": "VARA2019CPU123456", "serial": "SR123456"}'

this is my logstash.conf file

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/ipcl"  
# The user we wish to execute our statement as  
jdbc\_user =\> "root"  
jdbc\_password =\> ""  
# The path to our downloaded jdbc driver  
jdbc\_driver\_library =\> "mysql-connector-java-5.1.38.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
# our query  
statement =\> "SELECT name as assetname,serial FROM glpi\_computers"  
}  
}

filter {  
json {  
source =\> "MYSQL"  
}  
date {  
match =\> ["date","UNIX\_MS"]  
target =\> "@timestamp"  
}  
}

output {  
stdout { codec =\> json\_lines }  
elasticsearch {  
hosts =\> "localhost:9200"  
manage\_template =\> false  
index =\> "vm-mysql"  
}  
}

Error :  
[2019-07-16T21:36:51,016][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"vm-mysql", :\_type=\>"\_doc", :routing=\>nil}, #LogStash::Event:0x29f22037], :response=\>{"index"=\>{"\_index"=\>"vm-mysql", "\_type"=\>"\_doc", "\_id"=\>"ydOJ-2sBW3M\_PSjzWTE4", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse field [@timestamp] of type [date] in document with id 'ydOJ-2sBW3M\_PSjzWTE4'", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"failed to parse date field [2019-07-16T16:06:50.228Z] with format [epoch\_second]", "caused\_by"=\>{"type"=\>"date\_time\_parse\_exception", "reason"=\>"Failed to parse with all enclosed parsers"}}}}}}  
[2019-07-16T21:36:51,918][INFO][logstash.runner] Logstash shut down.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 16, 2019, 4:37pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-field-timestamp-of-type-date/190789/2 "2019-07-16T16:37:25Z")

</div>

> [@Sandeep\_Bind](#):
>
> "failed to parse date field [2019-07-16T16:06:50.228Z] with format [epoch\_second]"

It looks to me like your index has a mapping that tells it what formats are acceptable for that field, and the field is not one of those formats. [Check](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html) the mapping.

---

<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: [August 13, 2019, 4:37pm UTC](https://discuss.elastic.co/t/logstash-failed-to-parse-field-timestamp-of-type-date/190789/3 "2019-08-13T16:37:39Z")

</div>

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