# Logstash date filter parsing year that is greater than 4 digits

**URL:** <https://discuss.elastic.co/t/logstash-date-filter-parsing-year-that-is-greater-than-4-digits/186683>\
**Category:** Logstash\
**Created:** [June 20, 2019, 12:29pm UTC](https://discuss.elastic.co/t/logstash-date-filter-parsing-year-that-is-greater-than-4-digits/186683 "2019-06-20T12:29:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsmoorthy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsmoorthy/32/35975_2.png) [@rsmoorthy](https://discuss.elastic.co/u/rsmoorthy)\
**Post date:** [June 20, 2019, 12:29pm UTC](https://discuss.elastic.co/t/logstash-date-filter-parsing-year-that-is-greater-than-4-digits/186683/1 "2019-06-20T12:29:51Z")

</div>

With a logstash filter like this:  
date {  
match =\> ["logdate", "YYYY-MM-dd HH:mm:ss"]  
}

and the value of logdate being **12019-06-17 15:09:16**

I would expect the date filter to fail the match, as there are 5 digits. But logstash date filter is accepting and creating a timestamp like this:

```
"@timestamp" => 12019-06-17T15:09:16.000Z,

```

It seems to accept any number of digits in the year (1...n) where I checked upto 7 digits.

I feel this is a bug, since the format provided is specifically 4 digits ("yyyy" or "YYYY").

How do we ensure that the date is validated to be valid date by logstash date filter match? where it should not match those invalid dates.

---

<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 18, 2019, 12:30pm UTC](https://discuss.elastic.co/t/logstash-date-filter-parsing-year-that-is-greater-than-4-digits/186683/2 "2019-07-18T12:30:08Z")

</div>

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