# Match field based on content via regex

**URL:** <https://discuss.elastic.co/t/match-field-based-on-content-via-regex/83660>\
**Category:** Logstash\
**Created:** [April 26, 2017, 7:27am UTC](https://discuss.elastic.co/t/match-field-based-on-content-via-regex/83660 "2017-04-26T07:27:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![evlonden](https://avatars.discourse-cdn.com/v4/letter/e/3d9bf3/32.png) [@evlonden](https://discuss.elastic.co/u/evlonden)\
**Post date:** [April 26, 2017, 7:27am UTC](https://discuss.elastic.co/t/match-field-based-on-content-via-regex/83660/1 "2017-04-26T07:27:06Z")

</div>

Hello,

Loglines often contains a severity field containing INFO, WARNING etc. I tried to use a pattern like

BREVTCLASS (?:INFO?|WARNING?|ERROR?|CRITICAL?)

which I pick up in grok with  
%{BREVTCLASS:syslog\_evtclass}

but loglines such as this

> \<150\>Apr 26 17:13:25 Sydney\_ILAB\_DCX8510 raslogd: 2017/04/26-17:13:25, [LOG-1000], 1748, SLOT 4 WWN 10:00:50:eb:1a:59:0b:00 | FID 128, **INFO,** Sydney\_ILAB\_DCX8510, Previous message repeated 4 time(s).

continuously show a grokparse failure.

Any ideas?

Thanks

---

<div class="post-metadata">

**Author:** ![evlonden](https://avatars.discourse-cdn.com/v4/letter/e/3d9bf3/32.png) [@evlonden](https://discuss.elastic.co/u/evlonden)\
**Post date:** [April 26, 2017, 7:28am UTC](https://discuss.elastic.co/t/match-field-based-on-content-via-regex/83660/2 "2017-04-26T07:28:13Z")

</div>

Ohh, PS. that is the rule that traps the grok parse failure as when I remove that the others in the same match statement succeed

---

<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:** [May 24, 2017, 7:36am UTC](https://discuss.elastic.co/t/match-field-based-on-content-via-regex/83660/3 "2017-05-24T07:36:15Z")

</div>

Closed on May 24, 2017, 7:36am UTC

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