[SERVER-67100] MongoDB Log file size issue Created: 08/Jun/22  Updated: 30/Aug/22  Resolved: 30/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.0.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Nandkishor Chavan Assignee: Edwin Zhou
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

We are using MongoDB 4.0.4 version for our project. The database configuration is done as below:
1. Created a custom database in MongoDB and the service is running in authentication mode. 
2. Using Windows systems (Server and Desktop both)
We have observed that the MongoDB log file size gets increased over the period and consumes disk space in GBs. Mongo creates a new log file only after the MongoDB service is rebooted. Due to the large size issue, we want to do either:
1. Control the entries in the log file (We have tried by setting different verbose levels)
2. Use logrotate command (The command doesn't work on Windows as intended, though we have read it on forums that it supports only Linux)
3. Delete log files (We can manually delete all log files, but when we try to delete it programmatically through windows service, it only deletes backup files, but the active file gives an error as file in use)
Is there any other solution that we can try? Thanks in advance.



 Comments   
Comment by Edwin Zhou [ 30/Aug/22 ]

We haven’t heard back from you for some time, so I’m going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by Edwin Zhou [ 17/Aug/22 ]

Hi ndchavan4289@gmail.com,

We still need additional information to diagnose the problem. If this is still an issue for you, would you please upgrade to MongoDB v4.2+ and see if this problem persists?

Best,
Edwin

Comment by Edwin Zhou [ 11/Jul/22 ]

Hi ndchavan4289@gmail.com,

Thank you for your patience while I investigate this issue.

Log rotation was added for Windows in SERVER-2612 and resolved in 2.1.

MongoDB v4.0 reached end of life in April 2022 and is no longer supported. Can you please upgrade to MongoDB v4.2+ and see if this problem persists?

Alternatively, we've previously recommended handling log rotation using logrotate, a common configurable daemon available on Linux, macOS, and Windows.
or more information about rotating log files, see https://docs.mongodb.com/manual/tutorial/rotate-log-files/

For more information about logrotate, see:

https://linux.die.net/man/8/logrotate

https://wiki.archlinux.org/index.php/logrotate

https://formulae.brew.sh/formula/logrotate

https://chocolatey.org/packages/LogRotate

https://github.com/logrotate/logrotate

Best,
Edwin

Generated at Thu Feb 08 06:07:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.