# Exclude multiple patterns in logstash s3 input

**URL:** <https://discuss.elastic.co/t/exclude-multiple-patterns-in-logstash-s3-input/315917>\
**Category:** Logstash\
**Created:** [October 5, 2022, 11:23pm UTC](https://discuss.elastic.co/t/exclude-multiple-patterns-in-logstash-s3-input/315917 "2022-10-05T23:23:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elias\_Ojeda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elias_ojeda/32/111721_2.png) [@Elias\_Ojeda](https://discuss.elastic.co/u/Elias_Ojeda)\
**Post date:** [October 5, 2022, 11:23pm UTC](https://discuss.elastic.co/t/exclude-multiple-patterns-in-logstash-s3-input/315917/1 "2022-10-05T23:23:58Z")

</div>

Logstash S3 input has an option to exclude a pattern. The example shows how to exclude a single pattern. For example:  
"exclude\_pattern" =\> "/2020/04/"

Is it possible to exclude multiple patterns?  
For example, exclude all the logs containing the following in the path:  
/2019/03/  
/2019/02/  
/2020/02/  
/2020/03/

---

<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:** [October 5, 2022, 11:55pm UTC](https://discuss.elastic.co/t/exclude-multiple-patterns-in-logstash-s3-input/315917/2 "2022-10-05T23:55:59Z")

</div>

[exclude\_pattern](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-s3.html#plugins-inputs-s3-exclude_pattern) is a Ruby style regexp, so yes, you can use alternation.

```
exclude_pattern => "\/2019\/03\/|\/2019\/02\/|\/2020\/02\/|\/2020\/03\/"

```

---

<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 2, 2022, 11:56pm UTC](https://discuss.elastic.co/t/exclude-multiple-patterns-in-logstash-s3-input/315917/3 "2022-11-02T23:56:44Z")

</div>

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