1) ElasticSearch
2) Kibana
3) Logstash
4) Mongodb
5) Set JAVA_HOME
Steps to store MongoDB logs on ElasticSearch and visualize them on Kibana
Step1- Download latest version:
- Elasticsearch
- Kibana
- Logstash
It can be downloaded from “www.elasticsearch.org”
Step2- Run elasticsearch (bin/elasticsearch)

Step3- Create a configuration file in the bin folder of Logstash and save it as “logstash.conf”
logstash.conf
input {
file {
path => "C:\Data\log\filter-mongologs-2017-03-18\mongodb-current.log"
start_position => "beginning"
}
}
filter {
grok {
match => {message => "%{TIMESTAMP_ISO8601:timestamp} %{MONGO3_SEVERITY:severity} % {MONGO3_COMPONENT:component}%{SPACE}(?:\[%{DATA:context}\])? % {GREEDYDATA:content}.*%{NUMBER:duration}+ms"}
}
mutate {
remove_field => ["message" ,"timestamp" , "tags" , "@version" ]
}
if [component] != "COMMAND" {
drop { }
}
}
Output :
{
elasticsearch{ hosts => ["localhost:9200"] index => "mongolog7" }
tdout{codec => "rubydebug"}
}
(Add the path of mongodb log file in input of logstash configuration file.)
Step4- Install Mongodb input plugin
> logstash-plugin install logstash-input-mongodb

Step5- Install elasticsearch output plugin
> logstash-plugin install logstash-output-elasticsearch

Step6- In command prompt run the following command under /bin directory
> /bin/logstash –f logstash.conf