Closed futurechan closed 10 years ago
This really depends on the timeframe. Currently it tries to reconnect 4 times, each after 100 ms. If the connections is down for a longer period, reconnection will not be possible. If you have a specific need, please go ahead. Pull requests are welcome.
@chris-rock it looks like it might already be supported
I can set options.max_connect_retries
this.max_connect_retries = ('number' === typeof options.max_connect_retries) ? options.max_connect_retries : 4;
and if I set it to a negative number, it will retry indefinitely.
if (self.max_connect_retries < 0 || self.retries < self.max_connect_retries) {
if (!self.connecting) {
setTimeout(function () {
self.connect();
}, 100);
}
} else {
self.log_queue = [];
self.silent = true;
}
Does that seem right? My only concern is the log queue may grow indefinitely. Also, 100 ms may be to short. Could we make that configurable too? I am willing to issue the PR.
Would you be interested in introducing https://github.com/trevnorris/cbuffer instead of using an array? We would push logs onto the CBuffer and shift them off the front. This will allow us to keep a fixed number of logs.
@futurechan -1 one is the value to do it indefinitely. I think it makes sense to make max_connect_retries
and 'timeout' configurable. The combination with cbuffer looks good. I would be happy to merge your contributions.
If I am running my app and logstash goes down and then comes back up, my apps logs never resume into logstash.
I understand if logs are dropped while logstash is down, but if it comes back, can we not resume logging into logstash?