# Date filter failing to set logs time as @timestamp field

**URL:** <https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255>\
**Category:** Logstash\
**Created:** [August 28, 2015, 3:33pm UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255 "2015-08-28T15:33:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EitanVes](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@EitanVes](https://discuss.elastic.co/u/EitanVes)\
**Post date:** [August 28, 2015, 3:33pm UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255/1 "2015-08-28T15:33:22Z")

</div>

Hi Guys,  
I have some issue with passing these time stamps from my log files through the Date filter.  
13 AUG 2015 | 05:08:57 |

i wrote a grok filter that generates the field "logTimeStamp" as follows:

mutate{  
add\_field =\> { "logTimeStamp" =\> "%{day} %{month} %{year} %{time}" }  
}  
And later a Date filter as follows:

```
date{
 match =>["logTimeStamp","dd MMM YYYY HH:mm:ss"]
}

```

Yet the Date filter keeps failing an generating error msgs.

any idea why?

Thanks for the support  
Eitan

---

<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 29, 2015, 3:22pm UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255/2 "2015-08-29T15:22:53Z")

</div>

So... logTimeStamp would in your example contain "13 AUG 2015 05:08:57"? What error message do you get? I think the date parsing library can be picky about the case of month names, so my guess is that it's choking on AUG.

---

<div class="post-metadata">

**Author:** ![EitanVes](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@EitanVes](https://discuss.elastic.co/u/EitanVes)\
**Post date:** [August 29, 2015, 3:33pm UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255/3 "2015-08-29T15:33:29Z")

</div>

THanks Magnus,

Error msg is as follows:

```
[33mFailed parsing date from field {:field=>"logTimeStamp", :value=>"%{day} %{month} %{year} %{time}", :exception=>"Invalid format: \"%{day} %{month} %{year} %{time}\"", :config_parsers=>"dd MMM YYYY HH:mm:ss", :config_locale=>"default=en_US", :level=>:warn}←[0m

```

my prime suspect is upper case AUG,  
i was thinking about either looking for a locale with uppercase writing (failed so far) or altering the month name string to "Aug" or "aug"  
in this case, how is it achievable?  
What would you suggest?

THanks!  
Eitan

---

<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 29, 2015, 4:04pm UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255/4 "2015-08-29T16:04:28Z")

</div>

It looks like your `day`, `month`, `year`, and `time` fields are never set, so `logTimeStamp` gets a bogus value. How are you setting those fields and what does a complete message look like? Use a stdout output with `codec => rubydebug`.

---

<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, 5:30am UTC](https://discuss.elastic.co/t/date-filter-failing-to-set-logs-time-as-timestamp-field/28255/5 "2017-07-06T05:30:40Z")

</div>


