# Ingesting large number of files in a directory using logstash

**URL:** <https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168>\
**Category:** Logstash\
**Tags:** ingest-pipeline\
**Created:** [March 24, 2021, 6:23am UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168 "2021-03-24T06:23:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Razeen](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Razeen](https://discuss.elastic.co/u/Razeen)\
**Post date:** [March 24, 2021, 6:23am UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168/1 "2021-03-24T06:23:01Z")

</div>

Hi,

I have a logstash configuration to ingest large number of json files from a directory.  
The ingestion works perfectly fine, But for a particular number of json files.

For example i pointed the input for a folder with 400000 json files and it gets ingested without a problem. But when I point the input for a folder with 1000000 json files, it does not ingest.

Any idea of why this could happen ?

---

<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:** [March 24, 2021, 3:01pm UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168/2 "2021-03-24T15:01:41Z")

</div>

What does your input configuration look like? What version are you using?

There are issue related to large numbers of files, some of which have been fixed ([here](https://github.com/logstash-plugins/logstash-input-file/issues/241) and [here](https://github.com/logstash-plugins/logstash-input-file/issues/219)).

---

<div class="post-metadata">

**Author:** ![Razeen](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Razeen](https://discuss.elastic.co/u/Razeen)\
**Post date:** [March 24, 2021, 3:19pm UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168/3 "2021-03-24T15:19:47Z")

</div>

Hi Badger,  
My input looks as follows,

```auto
input {
 file {
 path => "/home/ubuntu/filesPath/*.json"
 sincedb_path => "/dev/null"
 codec => json
 mode => read
 file_chunk_size => 131072
 }
}

```

and the version is logstash 7.10.2

---

<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:** [March 24, 2021, 8:24pm UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168/4 "2021-03-24T20:24:31Z")

</div>

I believe 7.10.2 would have a 4.2.x file plugin. You could verify using

```
cd /usr/share/logstash; bin/logstash-plugin list --verbose logstash-input-file

```

I suggest you point logstash at a folder with a million json files, wait a while, then get a thread dump (kill -3, or jstack, or whatever tool you prefer) and what the runnable threads are doing. If you are unable to interpret the thread dump then post a gist or put it on on some other site where I can view the text and I will see if I can tell what it is doing.

---

<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:** [April 21, 2021, 8:25pm UTC](https://discuss.elastic.co/t/ingesting-large-number-of-files-in-a-directory-using-logstash/268168/5 "2021-04-21T20:25:00Z")

</div>

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