# Date Filter recognized string format

**URL:** <https://discuss.elastic.co/t/date-filter-recognized-string-format/181382>\
**Category:** Logstash\
**Created:** [May 16, 2019, 11:11am UTC](https://discuss.elastic.co/t/date-filter-recognized-string-format/181382 "2019-05-16T11:11:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio\_addivinola](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_addivinola/32/45644_2.png) [@antonio\_addivinola](https://discuss.elastic.co/u/antonio_addivinola)\
**Post date:** [May 16, 2019, 11:11am UTC](https://discuss.elastic.co/t/date-filter-recognized-string-format/181382/1 "2019-05-16T11:11:55Z")

</div>

Hi everyone!  
I have a problem using the logstash date filter. I have a date string formatted like this:  
ddMMyyyy'T'HHmmss  
in a field (called scheduledTime) of a json log.

I need to convert this string into a date to index into Elasticsearch. I'm trying to use the date filter like this  
date {  
match =\> ["scheduledTime", "ddMMyyyy'T'HHmmss"]  
}  
but this doesn't work. But if I change the way the string is formatted, using the following format  
yyyy-MM-dd'T'HH:mm:ss  
and then change the format specified in the date filter like this  
date {  
match =\> ["scheduledTime", "yyyy-MM-dd'T'HH:mm:ss"]  
}  
everything works fine and scheduledTime field is indexed as Date on Elasticsearch.

My question is: how can I use the date filter to use the first format (ddMMyyyy'T'HHmmss)? Is there somethins else I need to specify somewhere?

Regards,  
Antonio.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 16, 2019, 12:20pm UTC](https://discuss.elastic.co/t/date-filter-recognized-string-format/181382/2 "2019-05-16T12:20:08Z")

</div>

Parsing a field with that pattern works just fine

```
    mutate { add_field => { "scheduledTime" => "20101999T123456" } }
    date { match => ["scheduledTime", "ddMMyyyy'T'HHmmss"] }

```

produces

```
"scheduledTime" => "20101999T123456",
   "@timestamp" => 1999-10-20T12:34:56.000Z

```

Can you show us with a rubydebug codec on stdout exactly what you think fails to get parsed?

---

<div class="post-metadata">

**Author:** ![antonio\_addivinola](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_addivinola/32/45644_2.png) [@antonio\_addivinola](https://discuss.elastic.co/u/antonio_addivinola)\
**Post date:** [May 16, 2019, 1:18pm UTC](https://discuss.elastic.co/t/date-filter-recognized-string-format/181382/3 "2019-05-16T13:18:25Z")

</div>

Yes, you are right. The date string in the produced log are in a format different from what was comunicated ☹. Sorry for the misunderstanding and thank you very much for your support.

Regards  
Antonio.

---

<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:** [June 13, 2019, 1:18pm UTC](https://discuss.elastic.co/t/date-filter-recognized-string-format/181382/4 "2019-06-13T13:18:38Z")

</div>

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