# Is it possible to detect a specific file that enters inside a folder by type with logstash?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-detect-a-specific-file-that-enters-inside-a-folder-by-type-with-logstash/278829>\
**Category:** Logstash\
**Created:** [July 15, 2021, 6:36pm UTC](https://discuss.elastic.co/t/is-it-possible-to-detect-a-specific-file-that-enters-inside-a-folder-by-type-with-logstash/278829 "2021-07-15T18:36:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raylight](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raylight/32/77615_2.png) [@raylight](https://discuss.elastic.co/u/raylight)\
**Post date:** [July 15, 2021, 6:36pm UTC](https://discuss.elastic.co/t/is-it-possible-to-detect-a-specific-file-that-enters-inside-a-folder-by-type-with-logstash/278829/1 "2021-07-15T18:36:56Z")

</div>

I know I can watch files entering in a folder with logstash using the following syntax:

```auto
input {
     file {
         type => "mytype"
         path => "/home/user/watchedFolder"
         start_position => "beginning"
         codec => json
     }
 }

```

However, I have files with different extensions entering this folder... Let's say I have both `.json` and `.txt` files. I'd like to make my input field detect only `.json` files. Is it possible? Can I make the input filter detect only files with specific extensions?

---

<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:** [July 15, 2021, 7:09pm UTC](https://discuss.elastic.co/t/is-it-possible-to-detect-a-specific-file-that-enters-inside-a-folder-by-type-with-logstash/278829/2 "2021-07-15T19:09:53Z")

</div>

> [@raylight](#):
>
> `path => "/home/user/watchedFolder"`

You could use

```
path => "/home/user/watchedFolder/*.json"

```

---

<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:** [August 12, 2021, 7:10pm UTC](https://discuss.elastic.co/t/is-it-possible-to-detect-a-specific-file-that-enters-inside-a-folder-by-type-with-logstash/278829/3 "2021-08-12T19:10:35Z")

</div>

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