# Logstash grok filters

**URL:** https://discuss.elastic.co/t/logstash-grok-filters/153122
**Category:** Logstash
**Created:** [October 19, 2018, 6:55am UTC](https://discuss.elastic.co/t/logstash-grok-filters/153122 "2018-10-19T06:55:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Gaurav\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@Gaurav\_Agarwal](https://discuss.elastic.co/u/Gaurav_Agarwal)
#### Post date: [October 19, 2018, 6:55am UTC](https://discuss.elastic.co/t/logstash-grok-filters/153122/1 "2018-10-19T06:55:09Z")

</div>

Hello  
I wanted to suppose we have a log and w define custom fields for the same and implement grok on it then on basis of a particular field as defined in the custom pattern how can we implement conditional cases on basis of the field as specified in the custom pattern.

Regards  
Gaurav

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [October 19, 2018, 7:01am UTC](https://discuss.elastic.co/t/logstash-grok-filters/153122/2 "2018-10-19T07:01:06Z")

</div>

I am not sure I understand what you mean. It would be a lot easier if you could provide a concrete example.

---

<div class="post-metadata">

### Author: ![Gaurav\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@Gaurav\_Agarwal](https://discuss.elastic.co/u/Gaurav_Agarwal)
#### Post date: [October 19, 2018, 8:08am UTC](https://discuss.elastic.co/t/logstash-grok-filters/153122/3 "2018-10-19T08:08:22Z")

</div>

Sep 13 09:59:43 hostname postfix/smtp[15739]: id: to=\<to [address@gmail.com](mailto:address@gmail.com)\>, [relay=gmail-smtp-in.l.google.com](http://relay=gmail-smtp-in.l.google.com)[hostip]:25, delay=1.9, delays=0.17/0/0.73/0.98, dsn=2.0.0, status=sent

suppose this is the log  
now the third field is named program in my custom pattern.  
I have four types of program and all this four types have different log format.

Now I want to implement the specific grok filters by using conditions on the basis of these program types.

---

<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: [November 16, 2018, 8:08am UTC](https://discuss.elastic.co/t/logstash-grok-filters/153122/4 "2018-11-16T08:08:22Z")

</div>

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