0

cureetly we are not having log rotater in my mongod.conf file.my version is mongodb3.4.3 how can i give log rotater in my mongod.conf file please check my conf file and give me suggestion where to add the log rotator in my conf fileand what to addenter image description here

1 Answer 1

0

If you are using *nix system, you have few choices. You can use logrotate service and send SIGUSR1 signal to mongod/mongos process. Or you can change your config systemLog.logRotate: rename and again send SIGUSR1.

To rotate log you can give command db.adminCommand( { logRotate : 1 } ) too.

How you do it on the windows side, that I don't know.

22
  • we are using centos7 and we have 4 shard cluster of each in each replicatset consits of (primary+secondary+arbiter ) and config server(primary+2secondaries) and mongos is in windows instance so i need to execute in all instances or can i run it in mongos
    – ashk
    Dec 8, 2017 at 11:11
  • Yes.. All Linux mongod instance logs you can handle with my answer. Those windows mongos must use some other method, but I guess that google can answer to that question. I guess that only working solution is that adminCommand with rename.
    – JJussi
    Dec 8, 2017 at 13:32
  • In every mongod instance i should run the db.adminCommand( { logRotate : 1 } ) is it correct also in arblter also
    – ashk
    Dec 8, 2017 at 17:42
  • Yes, you can rotate arbiter log file with db.adminCommand( { logRotate : 1 } ) too
    – JJussi
    Dec 9, 2017 at 8:26
  • /var/log/mongodb/*.log { daily rotate 5 compress dateext missingok notifempty sharedscripts copytruncate postrotate /bin/kill -SIGUSR1 cat /var/lib/mongodb/mongod.lock 2> /dev/null 2> /dev/null || true endscript } can i add this script in all mongod instances
    – ashk
    Dec 10, 2017 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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