Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround for some worker not autherized. #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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