Managing or delete log file

hello ,
now i have a very big log file exceed 280 GB,
can i mange or delete this file ?,
thanks a lot

On linux? Try this, or a variation as this one still retains the compressed & rotated files for a long time.


Welcome to the MongoDB Community @Abdelrahman_N_A!

The best approach would be setting up automatic log rotation and archiving as suggested by @chris. Options will vary depending on your O/S version, but on Linux or Unix logrotate is a standard utility.

You can also trigger log rotation using MongoDB’s logrotate administrative command, which might be useful as a first step to allow you to compress or archive your current large log file. I wouldn’t outright delete recent log files until you are certain you won’t need them for any diagnostic purposes.

If you need further suggestions, please confirm your O/S version so we can provide more relevant recommendations.


1 Like

thanks a lot , we tried it on windows server 2019 ,
when we used “db.adminCommand( { logRotate : 1 } )” command , mongo created a new file for log and rename the old file automatically

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