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

Failed to send event to MongoDB, retrying in 3 seconds {:event=>#<LogStash::Event:0x115d2456>, :exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x101bcedd @tag_sets=[], @server_selection_timeout=30, @options={:database=>"Logs", :user=>"username", :password=>"passwd"}>>} #78

Open
mouka99 opened this issue Mar 24, 2021 · 1 comment

Comments

@mouka99
Copy link

mouka99 commented Mar 24, 2021

I am trying to output log data from a local text file to mongodb:
`
input
{
file {
path => "/home/username/Data"
type => "cisco-asa"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}

filter
{
grok {
match => { "message" => "^%{SYSLOGTIMESTAMP:syslog_timestamp} %{HOSTNAME:device_src} %%{CISCO_REASON:facility}-%{INT:severity_level}-%{CISCO_REASON:f>
}

    date {
            match => ["syslog_timestamp", "MMM dd HH:mm:ss" ]
            target => "@timestamp"
    }

}

output
{
stdout {
codec => dots
}

    mongodb {
      id => "mongo-cisco"
      collection => "Cisco ASA"
      database => "Logs"
      uri => "mongodb://username:[email protected]:27017/Logs"
      codec => "json"
    }

}
`
logstash version: 7.11.1

When I add "+srv" to the uri, logstash shuts down immediately after startup yet the command I use to connect to the DB from the mongo shell is:
mongo "mongodb+srv://username:[email protected]:27017/Logs"
the same filter works fine when I ingest data in elasticsearch.
Please help, I need this for my end-of-studies project.

@phuongdo
Copy link

same with the problem with me, current version 3.1.7 does not support mongo alias mongodb+srv:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants