# Does File input work recursively

**URL:** <https://discuss.elastic.co/t/does-file-input-work-recursively/95612>\
**Category:** Logstash\
**Created:** [August 2, 2017, 8:30pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612 "2017-08-02T20:30:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [August 2, 2017, 8:30pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612/1 "2017-08-02T20:30:47Z")

</div>

Hi Everyone,

I am building up my logstash config and i am using the following file input plugin to ingest gzip files.

```
input {
file {
	path => "/home/niraj/sync/bigdata-dev"
	tags => "bigdata-dev1"
	codec => "gzip_lines"
	start_position => "beginning"
	sincedb_path => "gzip"
	type => "cloudtrail"
  }
}

```

My question here is that the path i am having has multiple sub-directories and each one of these have \*.gz files ( cloudtrail data ), will the file input recursively go through each sub-directories?

--  
Niraj

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 2, 2017, 8:36pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612/2 "2017-08-02T20:36:50Z")

</div>

That should work if your filename pattern is set up for that with `/home/niraj/sync/bigdata-dev/**/*.gz` or `/home/niraj/sync/bigdata-dev/*/*.gz` (not sure which one you need to use). Right now you've configured it to read a single file, /home/niraj/sync/bigdata-dev.

If you bump up the log level Logstash will log what filename patterns expand to.

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [August 2, 2017, 8:47pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612/3 "2017-08-02T20:47:51Z")

</div>

@magnusbaeck Thanks for the response. My directory structure is /home/niraj/sync/bigdata-dev/\*\*/.gz.

Do i need to add anything else to my file input?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 2, 2017, 9:04pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612/4 "2017-08-02T21:04:32Z")

</div>

> Do i need to add anything else to my file input?

No.

I saw that the asterisks in my previous post caused it to get mangled. I've fixed that.

---

<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 30, 2017, 9:04pm UTC](https://discuss.elastic.co/t/does-file-input-work-recursively/95612/5 "2017-08-30T21:04:46Z")

</div>

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