# Grok regex too long

**URL:** <https://discuss.elastic.co/t/grok-regex-too-long/254763>\
**Category:** Logstash\
**Created:** [November 9, 2020, 1:40pm UTC](https://discuss.elastic.co/t/grok-regex-too-long/254763 "2020-11-09T13:40:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_Fernando\_Palm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carlos_fernando_palm/32/77804_2.png) [@Carlos\_Fernando\_Palm](https://discuss.elastic.co/u/Carlos_Fernando_Palm)\
**Post date:** [November 9, 2020, 1:40pm UTC](https://discuss.elastic.co/t/grok-regex-too-long/254763/1 "2020-11-09T13:40:02Z")

</div>

Hello there. I am trying to apply a really long regex to a field in a log. I keep getting an error and logstash doesn't even start. The regex is made up of several smaller regexes connected with |, like this:

pattern\_definitions =\> {"text1" =\> "regex1|regex2|regex3|regex4|regex5"}

match =\> {"message" =\> "%{text1:text\_response}"}

I tried with just two regexes  
regex1|regex2  
and it works fine.

Is there any way this can be done?

---

<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:** [December 7, 2020, 1:40pm UTC](https://discuss.elastic.co/t/grok-regex-too-long/254763/2 "2020-12-07T13:40:05Z")

</div>

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