# Preventing specific events from being indexed

**URL:** <https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522>\
**Category:** Logstash\
**Created:** [March 26, 2021, 5:02pm UTC](https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522 "2021-03-26T17:02:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsmori](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsmori/32/47626_2.png) [@tsmori](https://discuss.elastic.co/u/tsmori)\
**Post date:** [March 26, 2021, 5:02pm UTC](https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522/1 "2021-03-26T17:02:54Z")

</div>

Is there a way to prevent specific events from being indexed? I don't mean specific fields, but conditionals for a field.

For example, we're ingesting netflow traffic data and I want to exclude all events that have both source and destination IPs from a specific range. While I know I can exclude these from search results, the point would be to cut down on the index sizes because netflow data is massive.

I'm guessing the best way might be with a pipeline processor, but honestly the docs for using pipelines is so arcane, I can't even get one to compile outside of something that's just descriptive. Even if I can get such a pipeline created, I don't know how it would get applied to the existing architecture.

---

<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:** [March 26, 2021, 5:17pm UTC](https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522/2 "2021-03-26T17:17:51Z")

</div>

You could do something like

```
cidr {
    add_field => { "[@metadata][srcMatch]" => true }
    address => ["%{srcIp}"]
    network => ["169.254.0.0/16", "fe80::/64"]
}
cidr {
    add_field => { "[@metadata][dstMatch]" => true }
    address => ["%{dstIp}"]
    network => ["169.254.0.0/16", "fe80::/64"]
}
if [@metadata][srcMatch] and [@metadata][dstMatch] { drop {} }
```

---

<div class="post-metadata">

**Author:** ![tsmori](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsmori/32/47626_2.png) [@tsmori](https://discuss.elastic.co/u/tsmori)\
**Post date:** [March 31, 2021, 3:48pm UTC](https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522/3 "2021-03-31T15:48:30Z")

</div>

Thanks, I'll give that a shot. I tried something similar with the cidr filter, setting a tag and then trying to drop by matching tags, but while Logstash didn't complain it also didn't work.

---

<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:** [April 28, 2021, 3:49pm UTC](https://discuss.elastic.co/t/preventing-specific-events-from-being-indexed/268522/4 "2021-04-28T15:49:19Z")

</div>

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