phutchins / logstash-input-mongodb

MongoDB input plugin for Logstash
Other
187 stars 104 forks source link

MONGODB | host being removed from the cluster. #42

Open drptbl opened 8 years ago

drptbl commented 8 years ago

Hey, I've got an issue with connection between LogStash and MongoDB.

MongoDB Version 3.3.9 Logstash Version 2.3.4-1

2016-07-21T14:03:54.930913520Z Settings: Default pipeline workers: 2
2016-07-21T14:03:55.346991872Z D, [2016-07-21T14:03:55.346000 #1] DEBUG -- : MONGODB | Adding IP:27018 to the cluster.
2016-07-21T14:03:55.397462102Z D, [2016-07-21T14:03:55.397000 #1] DEBUG -- : MONGODB | Adding 59dab37a6e17:27017 to the cluster.
2016-07-21T14:03:55.582269918Z D, [2016-07-21T14:03:55.581000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:03:55.586333543Z D, [2016-07-21T14:03:55.585000 #1] DEBUG -- : MONGODB | Server IP:27018 discovered as primary in replica set: 'rs0'. Changing topology to replica set.
2016-07-21T14:03:55.681482935Z D, [2016-07-21T14:03:55.680000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:55.690459992Z D, [2016-07-21T14:03:55.687000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.004s
2016-07-21T14:03:55.823540480Z D, [2016-07-21T14:03:55.821000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:55.838810649Z D, [2016-07-21T14:03:55.838000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.013s
2016-07-21T14:03:55.878286624Z D, [2016-07-21T14:03:55.877000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:55.881207073Z D, [2016-07-21T14:03:55.880000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.002s
2016-07-21T14:03:55.934179617Z D, [2016-07-21T14:03:55.933000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:55.936905464Z D, [2016-07-21T14:03:55.936000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.002s
2016-07-21T14:03:55.948433473Z D, [2016-07-21T14:03:55.947000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:55.951456885Z D, [2016-07-21T14:03:55.950000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.002s
2016-07-21T14:03:56.026110027Z D, [2016-07-21T14:03:56.024000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:56.030478215Z D, [2016-07-21T14:03:56.029000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.002s
2016-07-21T14:03:56.047168308Z D, [2016-07-21T14:03:56.046000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:56.051397686Z D, [2016-07-21T14:03:56.049000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.003s
2016-07-21T14:03:56.166734805Z D, [2016-07-21T14:03:56.166000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:56.168845318Z D, [2016-07-21T14:03:56.168000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.002s
2016-07-21T14:03:56.179821637Z D, [2016-07-21T14:03:56.179000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:56.182601771Z D, [2016-07-21T14:03:56.182000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.003s
2016-07-21T14:03:56.360019595Z D, [2016-07-21T14:03:56.357000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:56.363478803Z D, [2016-07-21T14:03:56.362000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.003s
2016-07-21T14:03:56.371330707Z D, [2016-07-21T14:03:56.371000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:56.373536476Z D, [2016-07-21T14:03:56.373000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.002s
2016-07-21T14:03:56.534728827Z Pipeline main started
2016-07-21T14:03:56.734602817Z D, [2016-07-21T14:03:56.734000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:56.737201519Z D, [2016-07-21T14:03:56.737000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.002s
2016-07-21T14:03:56.748718347Z D, [2016-07-21T14:03:56.748000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:56.751771200Z D, [2016-07-21T14:03:56.750000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.001s
2016-07-21T14:03:57.418523856Z D, [2016-07-21T14:03:57.417000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:57.426493735Z D, [2016-07-21T14:03:57.426000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.007s
2016-07-21T14:03:57.435871242Z D, [2016-07-21T14:03:57.435000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:57.445850020Z D, [2016-07-21T14:03:57.441000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.006s
2016-07-21T14:03:58.811576284Z D, [2016-07-21T14:03:58.811000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:03:58.816773559Z D, [2016-07-21T14:03:58.816000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.004s
2016-07-21T14:03:58.828617310Z D, [2016-07-21T14:03:58.828000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:03:58.838503594Z D, [2016-07-21T14:03:58.838000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.009999999999999998s
2016-07-21T14:04:01.451048043Z D, [2016-07-21T14:04:01.450000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | STARTED | {"find"=>"reports", "filter"=>{"_id"=>{"$gt"=>BSON::ObjectId('5790d01b6b469fb9e13f7014')}}, "limit"=>5000}
2016-07-21T14:04:01.457235672Z D, [2016-07-21T14:04:01.456000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.find | SUCCEEDED | 0.005s
2016-07-21T14:04:01.476911916Z D, [2016-07-21T14:04:01.476000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | STARTED | {"listCollections"=>1, "cursor"=>{}, "filter"=>{:name=>{"$not"=>/system\.|\$/}}}
2016-07-21T14:04:01.479310542Z D, [2016-07-21T14:04:01.478000 #1] DEBUG -- : MONGODB | IP:27018 | routine_reports.listCollections | SUCCEEDED | 0.002s
2016-07-21T14:04:05.592725429Z D, [2016-07-21T14:04:05.592000 #1] DEBUG -- : MONGODB | IP:27018 being removed from the cluster.
2016-07-21T14:04:10.848395264Z D, [2016-07-21T14:04:10.847000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:04:10.850026777Z D, [2016-07-21T14:04:10.849000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:04:36.680396897Z D, [2016-07-21T14:04:36.679000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:04:36.685525505Z MongoDB Input threw an exception, restarting {:exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x206510 tag_sets=[] server_selection_timeout=30 local_threshold=0.015>>, :level=>:warn}
2016-07-21T14:04:37.180376679Z D, [2016-07-21T14:04:37.179000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:07.126564411Z D, [2016-07-21T14:05:07.126000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:07.130668424Z MongoDB Input threw an exception, restarting {:exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x206510 tag_sets=[] server_selection_timeout=30 local_threshold=0.015>>, :level=>:warn}
2016-07-21T14:05:07.133406692Z D, [2016-07-21T14:05:07.132000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:36.141040717Z D, [2016-07-21T14:05:36.140000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:36.640674677Z D, [2016-07-21T14:05:36.640000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:37.140718973Z D, [2016-07-21T14:05:37.140000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known
2016-07-21T14:05:37.144758436Z MongoDB Input threw an exception, restarting {:exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x206510 tag_sets=[] server_selection_timeout=30 local_threshold=0.015>>, :level=>:warn}
2016-07-21T14:05:37.640441332Z D, [2016-07-21T14:05:37.640000 #1] DEBUG -- : MONGODB | getaddrinfo: name or service not known

input {
  mongodb {
    uri => 'mongodb://IP:27018/routine_reports?replicaSet=rs0'
    placeholder_db_dir => '/opt/logstash-mongodb/'
    placeholder_db_name => 'logstash_sqlite.db'
    collection => '^reports$'
    batch_size => 5000
  }
}

output {
  stdout { codec => rubydebug }

  file {
      path => "/opt/logstash-mongodb/mongo2es.log"
  }

  elasticsearch {
    index => "routine_reports"
    document_type => "test_report"
    document_id => "%{mongo_id}"
    hosts => ["IP:9201"]
  }
}

I'm not sure what's missing (or it's a bug?). Any help? Thanks in advance!

Regards, drptbl.

drptbl commented 8 years ago

Note: Looks like it works in some part, it connects to mongo, synchronizes data with ES and then it disconnects from mongo and crashes because can't connect back again. Because I'm using it inside docker, I'm able to overcome that by restarting this container each 5 minutes for example, to sync data, but then they're not synced in real-time.

ghost commented 5 years ago

me 2