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

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

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?

You could use

path => "/home/user/watchedFolder/*.json"
1 Like