# Convert string to date isnt working when logstash reading data from csv file. Need help!

**URL:** <https://discuss.elastic.co/t/convert-string-to-date-isnt-working-when-logstash-reading-data-from-csv-file-need-help/188898>\
**Category:** Logstash\
**Created:** [July 4, 2019, 11:16am UTC](https://discuss.elastic.co/t/convert-string-to-date-isnt-working-when-logstash-reading-data-from-csv-file-need-help/188898 "2019-07-04T11:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prataprajasekhar](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@prataprajasekhar](https://discuss.elastic.co/u/prataprajasekhar)\
**Post date:** [July 4, 2019, 11:16am UTC](https://discuss.elastic.co/t/convert-string-to-date-isnt-working-when-logstash-reading-data-from-csv-file-need-help/188898/1 "2019-07-04T11:16:49Z")

</div>

Dear All,

Need help resolving to convert string into date. The logstash is configured to read data from csv file and helps converts string to integer but not string to date for certain column.

Here is the sample data, software versions and configuration for your reference. Please help!!

# Sample data extracted from csv file:

9999999995,Wing-B Level 10,1181,Pre-Launch,Corporate,6/17/2019,00:00-09:00,50012065,Veg Cheese Sandwich,,0,115,115,0  
9999999996,Wing-B Level 10,1181,Pre-Launch,Corporate,6/17/2019,00:00-09:00,50012065,Veg Cheese Sandwich,,0,115,115,0

# software versions :

Logstash version : 6.7  
ElasticSearch version : 6.3

# Logstash configuration :

input {  
file {  
path =\> "/home/logstash/data\_oos\_csv\_load/\*.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "/home/logstash/data\_oos\_csv\_load/sincedb\_path\_for\_oos\_csv.log"  
tags =\> ["logstash-load-oos\_csv\_details"]  
}  
}

filter {  
csv {  
separator =\> ","  
columns =\> ["id", "location\_name", "location\_id", "stable\_status", "segment", "date", "time", "product\_id", "product\_name", "temperature", "essential\_flag", "estimated\_in\_stock\_time", "actual\_in\_stock\_time", "oos\_percentage"]  
convert =\> {  
"id" =\> "integer"  
"essential\_flag" =\> "integer"  
"estimated\_in\_stock\_time" =\> "integer"  
"actual\_in\_stock\_time" =\> "integer"  
"oos\_percentage" =\> "float"  
}  
}  
date {  
match =\> ["timestamp","mm/dd/yyyy"]  
target =\> "date"  
}  
}

output {  
if "logstash-load-oos\_csv\_details" in [tags]{  
elasticsearch {  
hosts =\> ["[superaws.live.94.com:9200](http://superaws.live.94.com:9200)"]  
index =\> "index-csv-oos"  
document\_id =\> "%{id}"  
user =\> logstash\_shipper  
password =\> shipper\_logstash  
}  
stdout {}

```
}

```

}

---

<div class="post-metadata">

**Author:** ![prataprajasekhar](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@prataprajasekhar](https://discuss.elastic.co/u/prataprajasekhar)\
**Post date:** [July 4, 2019, 12:24pm UTC](https://discuss.elastic.co/t/convert-string-to-date-isnt-working-when-logstash-reading-data-from-csv-file-need-help/188898/2 "2019-07-04T12:24:32Z")

</div>

Hi All,

This is now resolved by following steps stated in

> [@Convert date to string string](https://discuss.elastic.co/t/convert-date-to-string-string/181128/9):
>
> In your other case, you cannot have multiple match+target pairs in the same date filter. They should be separate filters. I am sorry, But i didnt understand what i should do if i have several date columns. Can you please share a simple test case how to handle such senario ? Thanks !!!!

---

<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 1, 2019, 12:24pm UTC](https://discuss.elastic.co/t/convert-string-to-date-isnt-working-when-logstash-reading-data-from-csv-file-need-help/188898/3 "2019-08-01T12:24:46Z")

</div>

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