Red Hat Bugzilla – Bug 1269227
MongoDB logs are directed to incorrect location / incorrect selinux context
Last modified: 2017-08-21 03:56:59 EDT
Description of problem: Upon installation of Satellite 6.1.2, MongoDB logs are directed to /var/lib/mongodb which automatically assigned them the selinux context: mongod_var_lib_t. This prevents the logs from being managed by logrotate even though Satellite provides configuration for them to be rotated. Version-Release number of selected component (if applicable): Satellite 6.1.2 How reproducible: 100% Steps to Reproduce: 1. Install Satellite 6.1.2. 2. Observe that mongodb logs are placed in /var/lib/mongodb Actual results: Logs for MongoDB placed in /var/lib/mongodb, wrong selinux context applied. logrotate is setup to control logs in /var/log/mongodb. To have correct logrotate, customer would need to configure the logpath correctly in /etc/mongodb.conf. They receive selinux context based on this rule: /var/lib/mongo.* all files system_u:object_r:mongod_var_lib_t:s0 Rule for the logs: /var/log/mongo.* all files system_u:object_r:mongod_log_t:s0 Expected results: MongoDB logs should be pushed to /var/log/mongodb, as this would solve any selinux context issues and work with the current implementation of /etc/logrotate.d/mongodb. Additional info: Appears that the logpatch is configured via puppet during install: class { 'mongodb': logpath => '/var/lib/mongodb/mongodb.log', dbpath => '/var/lib/mongodb', pidfilepath => $mongodb_pidfilepath, } ~>
This should now be handled properly with the newer pulp puppet module. I verified on an installation it was logging to the correct place and log rotate was occuring.
Also to note, the files in this new location appear to have the correct selinux context: [root@sat-r220-04 ~]# ls -lZ /var/log/mongodb/ -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-12T18-29-57 -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log-20160313 -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-13T07-14-03
Logs go to right place, with right context: [root@sat-r220-06 mongodb]# ls -lZ /var/log/mongodb/ -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log -rw-r--r--. mongodb mongodb system_u:object_r:mongod_log_t:s0 mongodb.log.2016-03-24T16-12-24
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1500
*** Bug 1317479 has been marked as a duplicate of this bug. ***