# Filter on a number in a log catch

**URL:** <https://discuss.elastic.co/t/filter-on-a-number-in-a-log-catch/107316>\
**Category:** Logstash\
**Created:** [November 12, 2017, 8:38pm UTC](https://discuss.elastic.co/t/filter-on-a-number-in-a-log-catch/107316 "2017-11-12T20:38:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pir1981](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@pir1981](https://discuss.elastic.co/u/pir1981)\
**Post date:** [November 12, 2017, 8:38pm UTC](https://discuss.elastic.co/t/filter-on-a-number-in-a-log-catch/107316/1 "2017-11-12T20:38:18Z")

</div>

Hi,

I have a message

filebeat -- ERROR -- Nov 11 23:59:34 server25 smartd[12032]: Device: /dev/sda [SAT], SMART Prefailure Atribute: 1Raw\_Read\_Error\_Rate changes from XX to YY

Where XX is a number and YY is a number i.e. "83 to 77" or "89 to 100"... Both are different most of the time, not just to each other, but to previous messages as well.  
I keep getting this message multiple times a day and would like to only get it when YY drops below ... I guess about 50. I am very new to logstash how can I filter out only YY, change ERROR to WARNIG if it is above 50 and otherwise leave it unchanged if below 50.

Thanks

---

<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:** [November 14, 2017, 6:27am UTC](https://discuss.elastic.co/t/filter-on-a-number-in-a-log-catch/107316/2 "2017-11-14T06:27:25Z")

</div>

Use a grok filter to extract the numbers into separate fields, then wrap a conditional around additional filters that e.g. update the loglevel field or whatever it is you want to do.

---

<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 12, 2017, 6:27am UTC](https://discuss.elastic.co/t/filter-on-a-number-in-a-log-catch/107316/3 "2017-12-12T06:27:41Z")

</div>

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