Open
Description
output plugin does not reconnecting to Mongo if connection is dropped.
Retry logic stuck in a loop. It will never retry to get connection to Mongo.
Howto reproduce:
- Start logstash with a Mongo output plugin
- Write something to logstash --> Data is stored to Mongo
- Shutdown Mongo (I run Mongo as Service in Windows, so I stop Mongo service)
- Write something to logstash
- I get error: Failed to send event to MongoDB {:event=>2017-03-08T08:48:00.057Z _________ t4, :exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x7354 @tag_sets=[], @options=:database=>"admin"},@server_selection_timeout=30>>,
- Start Mongo service
- Same error occurs again and again
I have no experience of Ruby.
but if this is called only once:
def register
Mongo::Logger.logger = @logger
conn = Mongo::Client.new(@uri)
@db = conn.use(@database)
end # def register
Maybe conn = Mongo::Client.new(@uri) and @db = conn.use(@database) should be called if connection is dropped in def receive(event) function.