BMC Middleware Administration: Log rotation of "data.log" file from MongoDB

Version 1
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    TrueSight Middleware Administrator


    APPLIES TO:

    BMC Middleware Management - Administration



    QUESTION:

    BMC Middleware Administration V7.1 and later

    Under normal operations, the "data.log" file which gets written to and maintained by the MongoDB backend data base grows and gets appended to during the lifetime of the process.

    While under normal conditions, the log file growth is moderate, this still may cause disk space issues and some sort of log file management may be desired.
     


    ANSWER:

     

    Legacy ID:KA413798

      

    These comments apply to BMC Middleware Administration V7.2. Path and file names may be slightly different in other versions of the product, the concepts will remain the same, however. Note that version 7.0 of the product does not use MongoDB.

    MongoDB supports "Log rotation" only interactively. A command needs to be issued  which will close the current log file, rename it (file name will contain a time/date stamp), and open a new log file.

    The archived log files can then be further processed by tools like "logrotate" or similar.

    On Linux, all one needs to do is to send a signal (SIGUSR1) to the 'mongod' process in order to trigger the log rotation. The current process id for the 'mongod' process is stored in the file "mongod.lock" which resides in the "<install dir>/data/db" directory.

    The command to issue is

    kill -SIGUSR1 <pid>

    where <pid> needs to be replaced with the process id found in the "mongod.lock" file

    On Windows and Linux, the "logrotate" command can also be issued directly against the database. In order to do this, you need to connect to the "admin" database using the mongo shell and issue the the "logRotate" command.

    The binaries required to run the mongo shell (mongo / mongo.exe) are stored in
    <installdir>/mongodb/mongodb-win32-x86_64-2.4.9/bin (Linux)
    <installdir>\mongodb\mongodb-win32-x86_64-2.4.9\bin (Windows)

    In order to start the mongo shell, navigate to this directory and run the 'mongo' / 'mongo.exe' executable.

    From the mongo shell, then issue these commands:

    use admin
    db.runCommand( { logRotate : 1 } )
    exit

      

    BMC Middleware Administration V7.2 uses version 2.4 of MongoDB, so please refer to the respecting version of the MongoDB documentation for more information.
     

      
    Related Products:  
       
    1. BMC Middleware Management - Administration

     


    Article Number:

    000028155


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles