# Combining a dat field and a time field into a single timestamp

**URL:** <https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890>\
**Category:** Logstash\
**Created:** [November 21, 2019, 1:18pm UTC](https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890 "2019-11-21T13:18:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hyperion0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyperion0/32/54270_2.png) [@Hyperion0](https://discuss.elastic.co/u/Hyperion0)\
**Post date:** [November 21, 2019, 1:18pm UTC](https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890/1 "2019-11-21T13:18:33Z")

</div>

I have a text log with date and time listed as 2 separate fields and I want to combine them into a single date-time to use as my timestamp in Kibana.

The entry looks like this:  
10/03/19 18:04:40

My conf looks something like thins:  
...  
grok {  
match =\> { "%{DATA:loggedDate} %{DATA:loggedTime}" }  
}  
mutate {  
add\_field =\> { "%{eventLongTime}" =\> "%{loggedDate} %{loggedTime}" }  
}  
date {  
match =\> ["%{eventLongTime}", "MM/dd/yyyy HH:mm:ss"]  
}

Currently this produces the correct information in eventLongTime when I look at the stdout it says  
%{eventLongTime} =\> 10/03/19 18:04:40. but the date match is still all wrong. If anyone has any ideas or advice I'd appreciate it.

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [November 21, 2019, 1:37pm UTC](https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890/2 "2019-11-21T13:37:29Z")

</div>

Your date has a two-digit year, "`19`". You should use `yy` instead of `yyyy` in the date format of the `date` filter. The following should work:

```auto
MM/dd/yy HH:mm:ss

```

---

<div class="post-metadata">

**Author:** ![Hyperion0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hyperion0/32/54270_2.png) [@Hyperion0](https://discuss.elastic.co/u/Hyperion0)\
**Post date:** [November 21, 2019, 1:54pm UTC](https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890/3 "2019-11-21T13:54:44Z")

</div>

Thanks abdon!  
That seemed to do the trick.

---

<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:** [December 19, 2019, 1:55pm UTC](https://discuss.elastic.co/t/combining-a-dat-field-and-a-time-field-into-a-single-timestamp/208890/4 "2019-12-19T13:55:36Z")

</div>

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