Hi,@kailas,
To run a mangod process as a daemon (i.e.fork), and write its output to a log file, use the --fork and --logpath options. You must create the log directory; however, mangod will create the log file if it does not exist.
The following command starts mongod as a daemon and records log output to /var/log/mongodb/mongod.log.
mongod --fork --logpath /var/log/mongodb/mongod.log
I hope this will be helpful
To know more about Mongodb, it's recommended to join Mongodb Certification today.