# Field based filter

**URL:** <https://discuss.elastic.co/t/field-based-filter/181955>\
**Category:** Logstash\
**Created:** [May 21, 2019, 8:44am UTC](https://discuss.elastic.co/t/field-based-filter/181955 "2019-05-21T08:44:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)\
**Post date:** [May 21, 2019, 8:44am UTC](https://discuss.elastic.co/t/field-based-filter/181955/1 "2019-05-21T08:44:12Z")

</div>

Hi

I'm just trying to use logstash for filtering events. I wish to filter events based on event id. Event log format looks like below

**"field\_name":"field\_value", "field2\_name" : "field2\_value", "event\_id":1234,.........**

There may be multiple events where I need to filter few based on field\_Value

I'm expecting a conditional like below

**if event\_id == 1234**  
**{**  
\*\* aggregate\*\*  
**}**

Is it possible without grok???, I found difficulty in writing grok patterns, as there may be multiple formats. I thought straight forward field check will be helpful

will it be possible??

Thanks

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 21, 2019, 1:09pm UTC](https://discuss.elastic.co/t/field-based-filter/181955/2 "2019-05-21T13:09:58Z")

</div>

If your events are JSON you could use a json filter to parse them, and then a conditional like that would work. Can you provide more details?

---

<div class="post-metadata">

**Author:** ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)\
**Post date:** [May 21, 2019, 2:06pm UTC](https://discuss.elastic.co/t/field-based-filter/181955/3 "2019-05-21T14:06:20Z")

</div>

Thanks for the reply

I will give a try for JSON . What if my events are in CSV format??

---

<div class="post-metadata">

**Author:** ![sjabiulla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sjabiulla/32/48429_2.png) [@sjabiulla](https://discuss.elastic.co/u/sjabiulla)\
**Post date:** [May 21, 2019, 2:09pm UTC](https://discuss.elastic.co/t/field-based-filter/181955/4 "2019-05-21T14:09:54Z")

</div>

Try this  
[https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-csv.html)

---

<div class="post-metadata">

**Author:** ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)\
**Post date:** [May 29, 2019, 7:14am UTC](https://discuss.elastic.co/t/field-based-filter/181955/5 "2019-05-29T07:14:25Z")

</div>

Thanks. I'm able to handle this with KV plugin. In my case I created nested field in logstash similar to here, [Best Way to create nested field](https://discuss.elastic.co/t/best-way-to-create-nested-field/26757)

Now I need to show this nested data in Kibana. I guess Kibana doesnt support nested field in 5.6.13. So earlier I was using copy\_to through java code. I need to use same copy\_to approach in logstash. Putting it simple, how can I create copy\_to fields in Logstash??

---

<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:** [June 26, 2019, 7:14am UTC](https://discuss.elastic.co/t/field-based-filter/181955/6 "2019-06-26T07:14:32Z")

</div>

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