While running the command in the shell db.adminCommand( { logRotate : 1 } ) of arbiter it showing an error message as not authorized to run this command but in primary and secondary of replicaset its working. So what's the solution for this version is 3.4.3.


As per MongoDB BOL Here Rotate the log file by issuing the logRotate command from the admin database in a mongo shell:

db.adminCommand( { logRotate : 1 } )

You must issue the logRotate command against the admin database in the form:

{ logRotate: 1 }

Note : Your mongod instance needs to be running with the --logpath [file] option.

  • Its centos 7 but its not working arbiter it need authentication but while giving authentication which we are using for primary and seconadry in this replica set its not working for arbiter so whats the solution – ashk Jan 3 '18 at 5:04
  • @ashk,Have you checked your "logpath" or "systemLog.path" settings configuration. – Md Haidar Ali Khan Jan 3 '18 at 5:18
  • log path is same as primary and secondary but while using use admin and run this command db.adminCommand( { logRotate : 1 } ) its shownig not authorized to execute this command authentication required – ashk Jan 3 '18 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.