# Prune filter does not work with whitelist but it does with blacklist

**URL:** https://discuss.elastic.co/t/prune-filter-does-not-work-with-whitelist-but-it-does-with-blacklist/346549
**Category:** Logstash
**Created:** [November 6, 2023, 6:21pm UTC](https://discuss.elastic.co/t/prune-filter-does-not-work-with-whitelist-but-it-does-with-blacklist/346549 "2023-11-06T18:21:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![elk-user-0001](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@elk-user-0001](https://discuss.elastic.co/u/elk-user-0001)
#### Post date: [November 6, 2023, 6:21pm UTC](https://discuss.elastic.co/t/prune-filter-does-not-work-with-whitelist-but-it-does-with-blacklist/346549/1 "2023-11-06T18:21:51Z")

</div>

Hello colleagues!

I am trying to use the prune filter with first level fields ( I know the problem with nested fields ) but I can't get it to work.

I have a json of 900 fields and I am interested in keeping only a few, I understand that the best option is the prune via whitelist however this does not work.

When I change whitelist to blacklist, logstash removes the fields I want to keep and ingest the rest.

When I set whitelist it doesn't create the index I want to send to, it's as if it drops everything.

What can cause blacklist to remove my fields of interest but whitelist does not keep them ?

filter example:

```auto
if [type] == "cloned" {
    prune {
      whitelist_names => ["^msg$" , "uuid"]
    }
}

```

I would be very grateful for your help!  
Thank you so much in advanced!

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [November 9, 2023, 8:11pm UTC](https://discuss.elastic.co/t/prune-filter-does-not-work-with-whitelist-but-it-does-with-blacklist/346549/2 "2023-11-09T20:11:15Z")

</div>

Have you solved this?  
Can you show few field names? Is there any fields with similar names? E.g. time, time2, event\_time?

---

<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 7, 2023, 8:11pm UTC](https://discuss.elastic.co/t/prune-filter-does-not-work-with-whitelist-but-it-does-with-blacklist/346549/3 "2023-12-07T20:11:46Z")

</div>

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