- Logstash 1.5.x
- If you want to run Logstash 2.x, see the section titled Logstash 2.x below
- Mongostat 2.8+ (for support of the
--jsonflag)
- Copy all of the files from this gist into your Logstash directory. Put
logstash.confandes-template-mongostat.jsonin$LOGSTASH_DIR/conf/. - Edit the connection information in
conf/logstash.conffor your Elasticsearch output - If you change the index name, you'll also need to update the template name in
es-template-mongostat.json.
$ mongostat --json -h localhost --port 27017 -u bob -ppassword --authenticationDatabase admin --discover | python mongostat-filter.py | bin/logstash -f conf/logstash.confAll of these configs should work fine on Logstash 2.x as well, with the exception of two things:
- The
logstash-filter-bytes2humanplugin has not yet been updated for Logstash 2.x support. You'll need to manually install a patched version of this plugin if you wish to run 2.x. - The syntax for the
logstash-output-elasticsearchplugin has changed hostis nowhosts- The
protocoloption has been removed in favor of a separate plugin,logstash-output-elasticsearch_java, for communicating over protocols other than HTTP.