- Reference >
- Database Commands >
- logRotate
logRotate¶
-
logRotate
¶ The
logRotate
command is an administrative command that allows you to rotate the MongoDB logs to prevent a single logfile from consuming too much disk space. You must issue thelogRotate
command against the admin database in the form:Note
Your
mongod
instance needs to be running with the--logpath [file]
option.You may also rotate the logs by sending a
SIGUSR1
signal to themongod
process. If yourmongod
has a process ID of 2200, here’s how to send the signal on Linux:logRotate
renames the existing log file by appending the current timestamp to the filename. The appended timestamp has the following form:Then
logRotate
creates a new log file with the same name as originally specified by thelogpath
setting tomongod
ormongos
.