# Filter specific words from a field in logstash

**URL:** <https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614>\
**Category:** Logstash\
**Created:** [September 14, 2017, 10:23pm UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614 "2017-09-14T22:23:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [September 14, 2017, 10:23pm UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614/1 "2017-09-14T22:23:25Z")

</div>

I'm pulling data from SQL and one of the table has field called 'description' which contains values like alarm created, alarm discontinued, sound generated, api called, api call failed.  
All I wanted to do is capture only specific words like 'alarm','sound','api' from the value. How can I achieve this in logstash

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [September 15, 2017, 2:43am UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614/2 "2017-09-15T02:43:32Z")

</div>

You will have to use the grok filter on the specified field.

Regards,  
N

---

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [September 15, 2017, 2:37pm UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614/3 "2017-09-15T14:37:00Z")

</div>

Can you please elaborate as how to do it with grok. Here, the match is made on custom words

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [September 16, 2017, 2:32am UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614/4 "2017-09-16T02:32:23Z")

</div>

In grok, you write patterns to match the message field. Now in case you want to pick specific value from the description Field. Write a grok to match the values you need. You can write custom patterns or use regex.

Hope this helps.

---

<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:** [October 14, 2017, 2:32am UTC](https://discuss.elastic.co/t/filter-specific-words-from-a-field-in-logstash/100614/5 "2017-10-14T02:32:28Z")

</div>

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