Hi,
We are using fluentd-1.2.2 (td-agent-3.1.1-0.el7.x86_64.rpm).
fluentd buffer is used to buffer files. But we were facing issues when elasticsearch was down. The number of files created is increasing which results in all the fd resources being consumed.
so we updated to fluentd-1.2.2 where queued_chunks_limit_size parameter is available which limits the number of files created.
But unfortunately this does not limit the number of files created when destination is not reachable and this is consuming up the FD resources.
Below is a test td-agent.conf
<source>
@type dummy
tag "log.test"
dummy {"hello":"world"}
</source>
<match log.*>
@type copy
<store>
@type "elasticsearch"
@log_level "info"
include_tag_key true
host "elasticsearch"
port 9200
logstash_format true
logstash_prefix "journal"
<buffer tag>
@type "file"
path "/tmp/fluentd122/"
flush_mode interval
flush_interval 1s
retry_forever true
retry_max_interval 5s
chunk_limit_size 1k
queued_chunks_limit_size 2
</buffer>
</store>
<store>
@type "stdout"
</store>
</match>
Here have mentioned queued_chunks_limit_size as 2 and made the elasticsearch destination unreachable. As time goes the number of files created is increasing.
[root@vm-10-197-171-9 /tmp/fluentd122]$ ls -lhrt
total 172K
-rw-r--r--. 1 root root 60 Sep 10 10:37 buffer.q57581f1d58d817e450e4938bac6a273c.log
-rw-r--r--. 1 root root 72 Sep 10 10:37 buffer.q57581f1d58d817e450e4938bac6a273c.log.meta
-rw-r--r--. 1 root root 60 Sep 10 10:37 buffer.q57581f1f428284446d11b211f6b9760a.log
-rw-r--r--. 1 root root 72 Sep 10 10:37 buffer.q57581f1f428284446d11b211f6b9760a.log.meta
-rw-r--r--. 1 root root 9.6K Sep 10 10:42 buffer.q57581f212c12afd97f6a569ba588a68a.log
-rw-r--r--. 1 root root 74 Sep 10 10:42 buffer.q57581f212c12afd97f6a569ba588a68a.log.meta
-rw-r--r--. 1 root root 74 Sep 10 10:47 buffer.q5758204e7abe0bc0538fb389037fb397.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 10:47 buffer.q5758204e7abe0bc0538fb389037fb397.log
-rw-r--r--. 1 root root 74 Sep 10 10:52 buffer.q575821705b1558bf5f9173ff52d3dad2.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 10:52 buffer.q575821705b1558bf5f9173ff52d3dad2.log
-rw-r--r--. 1 root root 74 Sep 10 10:58 buffer.q575822924bc6724b4e00cba12fb89bec.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 10:58 buffer.q575822924bc6724b4e00cba12fb89bec.log
-rw-r--r--. 1 root root 74 Sep 10 11:03 buffer.q575823b43a1dbe2e4f388be78c6e2ed6.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 11:03 buffer.q575823b43a1dbe2e4f388be78c6e2ed6.log
-rw-r--r--. 1 root root 9.5K Sep 10 11:08 buffer.q575824d61df3e15bf315f62b3d19b55c.log
-rw-r--r--. 1 root root 74 Sep 10 11:08 buffer.q575824d61df3e15bf315f62b3d19b55c.log.meta
-rw-r--r--. 1 root root 74 Sep 10 11:13 buffer.q575825f8103290248f868b2ea2205e09.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 11:13 buffer.q575825f8103290248f868b2ea2205e09.log
-rw-r--r--. 1 root root 9.5K Sep 10 11:18 buffer.q57582719fe079e3e15de0d301c0a6cb3.log
-rw-r--r--. 1 root root 74 Sep 10 11:18 buffer.q57582719fe079e3e15de0d301c0a6cb3.log.meta
-rw-r--r--. 1 root root 74 Sep 10 11:23 buffer.q5758283be622dc9ec6ed9956f649561f.log.meta
-rw-r--r--. 1 root root 9.5K Sep 10 11:23 buffer.q5758283be622dc9ec6ed9956f649561f.log
-rw-r--r--. 1 root root 73 Sep 10 11:26 buffer.b5758295dd8bd9852d73f2751fdaea056.log.meta
-rw-r--r--. 1 root root 6.0K Sep 10 11:26 buffer.b5758295dd8bd9852d73f2751fdaea056.log
New buffer files are created indefinitely once the file size reaches 10K
Please let us know if there is something wrong with our configuration?
Thanks in advance,
Mahesh