# Conditionals and Dates

**URL:** <https://discuss.elastic.co/t/conditionals-and-dates/36387>\
**Category:** Logstash\
**Created:** [December 4, 2015, 1:46pm UTC](https://discuss.elastic.co/t/conditionals-and-dates/36387 "2015-12-04T13:46:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackal9301](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jackal9301/32/5748_2.png) [@Jackal9301](https://discuss.elastic.co/u/Jackal9301)\
**Post date:** [December 4, 2015, 1:46pm UTC](https://discuss.elastic.co/t/conditionals-and-dates/36387/1 "2015-12-04T13:46:32Z")

</div>

Issue: I have a lot of different logs coming from 1 source and separate date formats.

Situation:  
Hey everyone I have a conditional logstash file that takes a single input and runs multiple conditionals to determine which log file it is and how to parse it. My output is then to put them into Elasticsearch. I have roughly 40 logs i'm parsing therefor the date's of each log are different and different standards. All logs come from a single input with a header. I do an initial GROK to parse the header and put the rest of the data in a separate Log\_message field. At this point before the sort to parse each field in the log the date is embedded in Log\_message.

Question1: What is the best way to pull the date out of the Log\_message and set it as the timestamp field in elastic and kibana?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 5, 2015, 4:53am UTC](https://discuss.elastic.co/t/conditionals-and-dates/36387/2 "2015-12-05T04:53:15Z")

</div>

I want to say a date filter, but given your complexity I don't think that is what you want?

---

<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:** [December 5, 2015, 4:29pm UTC](https://discuss.elastic.co/t/conditionals-and-dates/36387/3 "2015-12-05T16:29:15Z")

</div>

Sounds like exactly what the grok and date filters are for. They both support trying multiple patterns and quitting on the first match they get.

---

<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:19am UTC](https://discuss.elastic.co/t/conditionals-and-dates/36387/4 "2017-07-06T05:19:53Z")

</div>

Closed on July 6, 2017, 5:19am UTC


