# Dateparsefailure - Error in Date value

**URL:** <https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326>\
**Category:** Logstash\
**Created:** [June 9, 2016, 12:04pm UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326 "2016-06-09T12:04:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon45970649](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon45970649](https://discuss.elastic.co/u/anon45970649)\
**Post date:** [June 9, 2016, 12:04pm UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326/1 "2016-06-09T12:04:31Z")

</div>

Hello everyone,  
I'm trying a few days to enter the csv file data, but I have not been able to take the lead in this error in the date field.

This message:  
`←[33mFailed parsing date from field {:field=>"Datahora", :value=>"2016-05-09 13: 57:49,B82528,265,\"-22.858118\",\"-43.371143\",0.19", :exception=>"Invalid forma t: \"2016-05-09 13:57:49,B82528,265,\"-22.858118\",\"-43.37...\" is malformed at \",B82528,265,\"-22.858118\",\"-43.37...\"", :config_parsers=>"YYYY-MM-dd HH:mm :ss.SSS", :config_locale=>"default=pt_PT", :level=>:warn}←[0m ←[33mFailed parsing date from field {:field=>"Datahora", :value=>"2016-05-09 13: 59:36,D86095,867,\"-22.931969\",\"-43.574604\",3.52", :exception=>"Invalid forma t: \"2016-05-09 13:59:36,D86095,867,\"-22.931969\",\"-43.57...\" is malformed at \",D86095,867,\"-22.931969\",\"-43.57...\"", :config_parsers=>"YYYY-MM-dd HH:mm :ss.SSS", :config_locale=>"default=pt_PT", :level=>:warn}←[0m{ "message" => "\"2016-05-09 11:28:32,B19524,665,\"\"-22.809641\"\",\"\"-43 .343151\"\",0\"\r", "@version" => "1", "@timestamp" => "2016-06-09T11:54:37.819Z", "path" => "c:/tmp/onibus.csv", "host" => "pc-marcio", "Datahora" => "2016-05-09 11:28:32,B19524,665,\"-22.809641\",\"-43.343151\ ",0", "tags" => [[0] "_dateparsefailure" ] }`

My CSV file:  
`Datahora,Ordem,Linha,Latitude,Longitude,Velocidade 2016-05-09 00:05:42,D53517,,"-22.883249","-43.495152",0 2016-05-09 00:20:08,B10547,,"-22.86828","-43.25724",0 2016-05-09 00:28:39,C41386,,"-22.8741","-43.241573",0.56 2016-05-09 00:30:29,D53568,,"-22.883801","-43.494732",0 2016-05-09 00:36:32,B58075,621,"-22.837311","-43.28672",27`

My logstash\_myapp.conf

> input {  
> file {  
> path =\> "c:/tmp/onibus.csv"  
> start\_position =\> "beginning"  
> }  
> }  
> filter {  
> if [message] =~ /\[1\]\*,/ {  
> drop { }  
> }  
> csv {  
> separator =\> ","  
> columns =\> ["Datahora","Ordem","Linha","Latitude","Longitude","Velocidade"]   
> }  
> date {  
> match =\> ["Datahora", "YYYY-MM-dd HH:mm:ss.SSS"]  
> remove\_field =\> ["Datahora"]   
> }   
> mutate {convert =\> ["Velocidade", "float"]}   
> }  
> output {  
> elasticsearch {  
> action =\> "index"  
> hosts =\> "localhost"  
> index =\> "myapp"  
> workers =\> 1  
> }  
> stdout { codec =\> rubydebug}  
> }

What is wrong?

* * *

1. a-z

---

<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:** [June 9, 2016, 12:39pm UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326/2 "2016-06-09T12:39:21Z")

</div>

> "message" =\> ""2016-05-09 11:28:32,B19524,665,""-22.809641"",""-43.343151"",0"\r",

Judging by this your input line actually looks like this (or that's at least what Logstash thinks):

```
"2016-05-09 11:28:32,B19524,665,""-22.809641"",""-43.343151"",0"

```

The initial double quote makes Logstash look for a closing quote before it considers the first column "done". Please check your input data once more.

---

<div class="post-metadata">

**Author:** ![anon45970649](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon45970649](https://discuss.elastic.co/u/anon45970649)\
**Post date:** [June 9, 2016, 12:57pm UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326/3 "2016-06-09T12:57:59Z")

</div>

Strange, my data seem to be correct. The quotes make a difference in the fields?

---

<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:** [June 9, 2016, 8:11pm UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326/4 "2016-06-09T20:11:57Z")

</div>

> Strange, my data seem to be correct.

Simplify your configuration. Start with the very simplest one that doesn't do anything but read the file and dump it to a `stdout { codec => rubydebug }` output. Does that look okay? Start adding things back so your configuration converges towards your current broken configuration. Observe what happens.

> The quotes make a difference in the fields?

Yes. Double quotes allows a field value to contain commas that otherwise would indicate the beginning of the next column.

---

<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, 4:53am UTC](https://discuss.elastic.co/t/dateparsefailure-error-in-date-value/52326/5 "2017-07-06T04:53:51Z")

</div>


