- 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
--json
flag)
- Copy all of the files from this gist into your Logstash directory. Put
logstash.conf
andes-template-mongostat.json
in$LOGSTASH_DIR/conf/
. - Edit the connection information in
conf/logstash.conf
for 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.conf
All of these configs should work fine on Logstash 2.x as well, with the exception of two things:
- The
logstash-filter-bytes2human
plugin 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-elasticsearch
plugin has changed host
is nowhosts
- The
protocol
option has been removed in favor of a separate plugin,logstash-output-elasticsearch_java
, for communicating over protocols other than HTTP.