# How to Mongodb logs to elasticsearch through logstash

**URL:** https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181
**Category:** Logstash
**Created:** [January 30, 2020, 12:35pm UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181 "2020-01-30T12:35:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jskishor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jskishor/32/61282_2.png) [@jskishor](https://discuss.elastic.co/u/jskishor)
#### Post date: [January 30, 2020, 12:35pm UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/1 "2020-01-30T12:35:16Z")

</div>

Hi There,

How do I send mongodb logs into elasticsearch.

While MongoDB is on a VM and logstash on other different server, what is the best way to ingest logs into Elasticsearch

Thanks  
Kishore

---

<div class="post-metadata">

### Author: ![inhinyera16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inhinyera16/32/61625_2.png) [@inhinyera16](https://discuss.elastic.co/u/inhinyera16)
#### Post date: [January 30, 2020, 2:02pm UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/2 "2020-01-30T14:02:04Z")

</div>

You might need to use this approach:

> [@MongoDB Logstash Integration \[Solved\]](https://discuss.elastic.co/t/mongodb-logstash-integration-solved/122299):
>
> I recently worked a lot about querying and writing values straight into MongoDB 3.6.2 from logstash. I noticed that many people in the forum tried to do the same thing and didn't succeed. I wanted to publish my solution, in case someone else need it. Hope you find this useful. If you find some way to simplify what I did, feel free to comment! grinning Reading From MongoDB: In my case, I had to periodically read new data arriving to MongoDB. In addition, I wanted to delay the processing of n…

---

<div class="post-metadata">

### Author: ![jskishor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jskishor/32/61282_2.png) [@jskishor](https://discuss.elastic.co/u/jskishor)
#### Post date: [January 31, 2020, 1:02pm UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/3 "2020-01-31T13:02:58Z")

</div>

Hi There,

Thanks for the reply, can you please explain me little as I am a newbie to ELK?  
My primary aim is to read the mongodb logs on one server to be shipped to elastic search and trigger alerts based on events such as startup, shutdown, etc

What is the best method to approach?  
Also please let me know where do I get the plugins though I could find them in logstash-plugin.bat list

---

<div class="post-metadata">

### Author: ![jskishor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jskishor/32/61282_2.png) [@jskishor](https://discuss.elastic.co/u/jskishor)
#### Post date: [February 4, 2020, 9:05am UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/4 "2020-02-04T09:05:31Z")

</div>

> [@jskishor](#):
>
> st meth

I could able to ingest logs from mongo by following 2 steps

1. Change the URL from localhost to 

Update the following parameters in elasticsearch.yml file

network.host:

# 

http.bind\_host:   
http.publish\_host:   
http.host:

Bounce Elastic Search

1. Ingest logs from mongodb into Elastic search

Install filebeat on the mongodb server  
Update filebeat.yml with following variables

#-------------------------- Elasticsearch output ------------------------------  
output.elasticsearch:

# Array of hosts to connect to.

hosts: [":9200"]

filebeat.inputs:

- type: log

1. Start filebeat using the below command  
./filebeat -e -v -c filebeat.yml

You'll start seeing the message  
2020-02-03T22:33:07.232-0800 INFO pipeline/output.go:105 Connection to backoff(elasticsearch(http://:9200)) established

Thanks!!

---

<div class="post-metadata">

### Author: ![jskishor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jskishor/32/61282_2.png) [@jskishor](https://discuss.elastic.co/u/jskishor)
#### Post date: [February 14, 2020, 7:38am UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/5 "2020-02-14T07:38:26Z")

</div>

I could able to ingest the logs directly from webserver where logs are hosted using filebeat to elasticsearch. I wanted to send the logs to elasticsearch through logstash.  
How do I do?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 13, 2020, 7:38am UTC](https://discuss.elastic.co/t/how-to-mongodb-logs-to-elasticsearch-through-logstash/217181/6 "2020-03-13T07:38:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
