# MONGODB | Error checking \<IP\>:\<PORT\>: Mongo::Error::MaxMessageSize: Message exceeds allowed max message size. The max is 50331648

**URL:** <https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750>\
**Category:** Logstash\
**Created:** [November 20, 2021, 6:14pm UTC](https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750 "2021-11-20T18:14:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bugsbee](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@Bugsbee](https://discuss.elastic.co/u/Bugsbee)\
**Post date:** [November 20, 2021, 6:14pm UTC](https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750/1 "2021-11-20T18:14:22Z")

</div>

hello,  
any idea as to why i get the error below? my ELK has been working on. its just today i chnaged he password.. and nothing else.  
however this time when i start elk , i get the error below

anything else i need to add in my config. mased from teh error says ive reached limit. but whre do i that? and whats the recommnded value here.

```auto
Logs:
W, [2021-11-20T18:58:30.318344 #2819632] WARN -- : MONGODB | Error checking IP HERE:port: Mongo::Error::MaxMessageSize: 

config:
    mongodb {
        type => "API_DTL"
        uri => 'mongodb://user here:password here@IP:PORT/DBNAME?ssl=false'
        placeholder_db_dir => '/opt/logstash-mongodb/api/'
        placeholder_db_name => 'mongodb.db'
                collection => 'API_collect'
        batch_size => 2000
    }

LOGS:

W, [2021-11-20T19:12:46.338561 #2830452] WARN -- : MONGODB | Failed to handshake with IP:PORT Mongo::Error::MaxMessageSize: Message exceeds allowed max message size. The max is 50331648.
W, [2021-11-20T19:12:46.339744 #2830452] WARN -- : MONGODB | Error checking 207.180.201.90:7979: Mongo::Error::MaxMessageSize: Message exceeds allowed max message size. The max is 50331648.

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 20, 2021, 6:52pm UTC](https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750/2 "2021-11-20T18:52:52Z")

</div>

> [@Bugsbee](#):
>
> `Mongo::Error::MaxMessageSize:`

MongoDB is trying to send logstash a message that is larger than the maximum message size that MongoDB supports. I would suggest trying a lower batch\_size.

---

<div class="post-metadata">

**Author:** ![Bugsbee](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@Bugsbee](https://discuss.elastic.co/u/Bugsbee)\
**Post date:** [November 21, 2021, 2:18am UTC](https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750/3 "2021-11-21T02:18:54Z")

</div>

> [@Bugsbee](#):
>
> `batch_size => 2000`

i tried to lower batch\_soze but still getting the same error. anything else that i migh thaver been mssing? or that i need to add? i tried 100,500 and 1000.

---

<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:** [December 19, 2021, 2:19am UTC](https://discuss.elastic.co/t/mongodb-error-checking-ip-port-mongo-message-exceeds-allowed-max-message-size-the-max-is-50331648/289750/4 "2021-12-19T02:19:06Z")

</div>

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