# String to Date, besides default system @timestamp

**URL:** https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269
**Category:** Logstash
**Created:** [August 30, 2016, 5:09am UTC](https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269 "2016-08-30T05:09:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Allie\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allie_yang/32/16538_2.png) [@Allie\_Yang](https://discuss.elastic.co/u/Allie_Yang)
#### Post date: [August 30, 2016, 5:09am UTC](https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269/1 "2016-08-30T05:09:09Z")

</div>

Hi I want to convert a String type field to Date type field, while keeping the system auto-generated @timestamp. The example log is below.  
Any ideas pls?

Mar 1 00:02:14 eqx-astockweb1 adobestock[59746]: {"app\_id":"as","geid":"21f40b51fa215f7996321baa868c6ab7","etid":"purchase","ev":1," **date**":"2015-12-31 23:02:14","mt":1451602934.82,"ip":"73.207.248.121","asui":"aea8fe2f3f4d5bf1b0fc6da3f6793a2a","session\_id":"0a024232eda44fa9c6bfd5c95e59ed06","member\_id":25241916,"is\_buyer":true,"url":"[https://stock.adobe.com/Order/Overage","locale":"en\_US","purchase":{"source":"web","type\_id":2,"sao":"70FE4517564739AC0A744C6B","order\_number":"AD019052392","content\_id":98060092,"delegate\_guid":null,"sku](https://stock.adobe.com/Order/Overage%22,%22locale%22:%22en_US%22,%22purchase%22:%7B%22source%22:%22web%22,%22type_id%22:2,%22sao%22:%2270FE4517564739AC0A744C6B%22,%22order_number%22:%22AD019052392%22,%22content_id%22:98060092,%22delegate_guid%22:null,%22sku)":null}}

**My current conf:**  
input {  
file {  
path =\> "/Users/yangyan/Desktop/log\_file/test.log"  
start\_position =\> "beginning"  
type =\> "json"  
codec =\> json  
}  
}

filter {  
grok{  
match =\> { "message" =\> "%{SYSLOGBASE} %{GREEDYDATA:message}" }  
overwrite =\> ["message"]  
}

json {  
source =\> "message"  
}

mutate{  
rename =\> { "[purchase][source]" =\> "p\_source" }  
rename =\> { "[purchase][type\_id]" =\> "p\_typeId" }  
rename =\> { "[purchase][content\_id]" =\> "p\_contentId" }  
}

**## doesn't work**  
date{  
match =\> ["date", "YYYY-MM-dd HH:mm:ss", "ISO8601"]  
timezone =\> "Europe/Dublin"  
target =\> "date"  
}

prune {  
whitelist\_names =\> ["@timestamp", "app\_id", "member\_id", "locale", "date", "p\_source", "p\_typeId", "p\_contentId"]  
}  
}

output {  
elasticsearch { hosts =\> ["localhost:9200"]}  
stdout { codec =\> rubydebug }  
}

---

<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: [August 30, 2016, 5:51am UTC](https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269/2 "2016-08-30T05:51:54Z")

</div>

Can you be more specific than "doesn't work"? Is the date filter not parsing the string? Or is the field not being recognized by ES as a date?

---

<div class="post-metadata">

### Author: ![Allie\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allie_yang/32/16538_2.png) [@Allie\_Yang](https://discuss.elastic.co/u/Allie_Yang)
#### Post date: [August 30, 2016, 10:38pm UTC](https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269/3 "2016-08-30T22:38:51Z")

</div>

Sorry my bad. It works now!

---

<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:40am UTC](https://discuss.elastic.co/t/string-to-date-besides-default-system-timestamp/59269/4 "2017-07-06T04:40:44Z")

</div>


