# String filter based on a file?

**URL:** <https://discuss.elastic.co/t/string-filter-based-on-a-file/198882>\
**Category:** Logstash\
**Created:** [September 10, 2019, 10:51am UTC](https://discuss.elastic.co/t/string-filter-based-on-a-file/198882 "2019-09-10T10:51:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KyFly-ESIEA](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@KyFly-ESIEA](https://discuss.elastic.co/u/KyFly-ESIEA)\
**Post date:** [September 10, 2019, 10:51am UTC](https://discuss.elastic.co/t/string-filter-based-on-a-file/198882/1 "2019-09-10T10:51:45Z")

</div>

HI there,

I'm really new ELK stack. I would like to know if it was possible to base a filter on a list, contained in a file ?

Basically, instead of :

```auto
if "string1" in [log] or "string2" in [log] or "string3" in [log] or ... {}

```

Is it possible to do something like :

```auto
if [log] in "./list_of_strings.txt" {}

```

My problem concerns a list of around 3000 strings. Is there some kind of plugin for this or my problem should not be addressed with Logstash ?

Have a nice day.

---

<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:** [September 10, 2019, 12:08pm UTC](https://discuss.elastic.co/t/string-filter-based-on-a-file/198882/2 "2019-09-10T12:08:59Z")

</div>

You could do this using a [translate](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html) filter. Your list\_of\_strings.txt would have to be a list\_of\_strings.csv where the second column in the csv was a fixed value. You would then test whether the [translation] field contained that fixed value after the translate filter executed.

---

<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 8, 2019, 12:09pm UTC](https://discuss.elastic.co/t/string-filter-based-on-a-file/198882/3 "2019-10-08T12:09:16Z")

</div>

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