MongoDB input plugin for Logstash
This is a plugin for Logstash.
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
This is a logstash plugin for pulling data out of mongodb and processing with logstash. It will connect to the database specified in uri, use the collection attribute to find collections to pull documents from, start at the first collection it finds and pull the number of documents specified in batch_size, save it's progress in an sqlite database who's location is specified by placeholder_db_dir and placeholder_db_name and repeat. It will continue this until it no longer finds documents newer than ones that it has processed, sleep for a moment, then continue to loop over the collections.
This was designed for parsing logs that were written into mongodb. This means that it may not re-parse db entries that were changed and already parsed.
Logstash installed from ZIP | TGZ
Logstash from GIT
…Example
input {
mongodb {
uri => 'mongodb://10.0.0.30/my-logs?ssl=true'
placeholder_db_dir => '/opt/logstash-mongodb/'
placeholder_db_name => 'logstash_sqlite.db'
collection => 'events_'
batch_size => 5000
}
}
filter {
date {
match => [ "logdate", "ISO8601" ]
}
}
output {
redis {
host => "localhost"
data_type => "list"
key => "logstash-mylogs"
}
}The URI parameter is where you would specify all of your mongodb options including things like auth and SSL. You should use a connection string (URI) compatible with the mongodb spec.
For more information on MongoDB URI's please see the MongoDB documentation: https://docs.mongodb.org/v3.0/reference/connection-string/
No open issues yet, or sync has not completed.