# GROK Filter for class / thread regex help please

**URL:** <https://discuss.elastic.co/t/grok-filter-for-class-thread-regex-help-please/159266>\
**Category:** Logstash\
**Created:** [December 4, 2018, 1:17am UTC](https://discuss.elastic.co/t/grok-filter-for-class-thread-regex-help-please/159266 "2018-12-04T01:17:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frrrrrunkis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frrrrrunkis/32/42750_2.png) [@Frrrrrunkis](https://discuss.elastic.co/u/Frrrrrunkis)\
**Post date:** [December 4, 2018, 1:17am UTC](https://discuss.elastic.co/t/grok-filter-for-class-thread-regex-help-please/159266/1 "2018-12-04T01:17:19Z")

</div>

trying to tackle a expression but im a novice.

Need to match the log4j thread name

${NOSPACE:thread} worked until I encountered spaces then spaces and brackets

need to match the following  
mulesoftlogs  
mulesoftlogs withaspace  
[mulesoftlogs with spacesandbrackets]

for the space and brackets I found the following solution online

`\[(?<thread>[^\]]+)?\]`

Then I ran into a about a dozen lined with this

[mulesoftlogs with a [[spaceand2brackets]]

which this pattern worked despite missing the trailing bracket in the resulting value  
`\]\[(?<thread>[^\]]+)?\]`

Then the last few grok failures stumped me.

[mulesoftlogs withaspace]andbracketsfaceingalldirections]]

not good enough to make this for in logstash ..

any help is appreciated thanks

---

<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:** [January 1, 2019, 1:17am UTC](https://discuss.elastic.co/t/grok-filter-for-class-thread-regex-help-please/159266/2 "2019-01-01T01:17:21Z")

</div>

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