# Multiple Grok patterns or can I use Regex?

**URL:** <https://discuss.elastic.co/t/multiple-grok-patterns-or-can-i-use-regex/214910>\
**Category:** Logstash\
**Created:** [January 13, 2020, 10:07pm UTC](https://discuss.elastic.co/t/multiple-grok-patterns-or-can-i-use-regex/214910 "2020-01-13T22:07:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IshanP1](https://avatars.discourse-cdn.com/v4/letter/i/82dd89/32.png) [@IshanP1](https://discuss.elastic.co/u/IshanP1)\
**Post date:** [January 13, 2020, 10:07pm UTC](https://discuss.elastic.co/t/multiple-grok-patterns-or-can-i-use-regex/214910/1 "2020-01-13T22:07:09Z")

</div>

I am making a centralised syslogging server. Do i have to make a different grok filter for every single different format of syslog or can I use something like regex to pick out certain elements of a log?

Dec 16 15:01:13 172.20.x.xx NPF\_OLT\_LAB05: service "403  
for ONT: "10002" - ONT needs restart at 2019/12/16 15:01:13.39 ONT message: "Backup files exist"

I have the grok pattern for the above log, but my question is - would I have to make a separate pattern layout for each different log layout, or can I use something like Regex to pick out key words ie: ONT "10002" and thus save time making separate patterns for everything.

Thank you!

---

<div class="post-metadata">

**Author:** ![Ramicoh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramicoh/32/61017_2.png) [@Ramicoh](https://discuss.elastic.co/u/Ramicoh)\
**Post date:** [January 13, 2020, 10:37pm UTC](https://discuss.elastic.co/t/multiple-grok-patterns-or-can-i-use-regex/214910/2 "2020-01-13T22:37:29Z")

</div>

I know this isn't a direct answer to your question, but if you're into Grok You may also want to have a look at some open source parsers, such as [https://github.com/empow/logstash-parsers/](https://github.com/empow/logstash-parsers/). Almost every parser published there uses the Grok processor and as they say - there's no need to reinvent the wheel 🙂

---

<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:** [February 10, 2020, 10:37pm UTC](https://discuss.elastic.co/t/multiple-grok-patterns-or-can-i-use-regex/214910/3 "2020-02-10T22:37:35Z")

</div>

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