Skip to content

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

@mouka99

Description

@mouka99

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:passwd@db.ghdqe.mongodb.net: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:passwd@db.ghdqe.mongodb.net:27017/Logs"
the same filter works fine when I ingest data in elasticsearch.
Please help, I need this for my end-of-studies project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions