I have changed the ownership of the mongod.conf to user mongodb
sudo chown -R mongodb:mongodb /etc/mongod.conf
and then rerun manually with the command:
sudo -u mongodb /usr/bin/mongod --auth --config /etc/mongod.conf
Now I am able to see logs inside
var/log/mongodb
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] allocator: tcmalloc
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] modules: none
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] build environment:
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] distarch: x86_64
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] target_arch: x86_64
2022-03-24T22:28:15.179+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", port: 23654 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, security: { authorization: "enabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2022-03-24T22:28:15.182+0200 I STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2022-03-24T22:28:15.182+0200 I STORAGE [initandlisten]
2022-03-24T22:28:15.182+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2022-03-24T22:28:15.182+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2022-03-24T22:28:15.182+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1463M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2022-03-24T22:28:16.844+0200 E STORAGE [initandlisten] WiredTiger error (13) [1648153696:844130][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1648153696:844130][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-03-24T22:28:16.844+0200 E STORAGE [initandlisten] WiredTiger error (13) [1648153696:844481][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1648153696:844481][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-03-24T22:28:16.845+0200 E STORAGE [initandlisten] WiredTiger error (13) [1648153696:845360][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1648153696:845360][24294:0x7f4bdfc9ab00], wiredtiger_open: __posix_open_file, 712: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2022-03-24T22:28:16.845+0200 W STORAGE [initandlisten] Failed to start up WiredTiger under any compatibility version.
2022-03-24T22:28:16.845+0200 F STORAGE [initandlisten] Reason: 13: Permission denied
I believe that all the problems were some kind related to the wrong ownership some mongo related files or directories have.