Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/logstash/outputs/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ def receive(event)
# and generate a new primary key.
# If the duplicate key error is on another field, we have no way
# to fix the issue.
elsif e.message =~ /^not authorized/
# Sometime worker cannot login when first insert.
# Re-login can resolve this not authorized problem.
@logger.warn("Not authorized, re-login...")
conn = Mongo::Client.new(@uri)
@db = conn.use(@database)
sleep @retry_delay
retry
else
sleep @retry_delay
retry
Expand Down