MongoDB tip, check for the location of mongod log from mongo shell

I never encountered this issue until I needed to log into the mongod administered by others and I don't have the host level access.

This can be done in both robomongo or via mongo shell

Using robomongo

Location of mongod log can be found by using the getCmdLineOpts command:




check the entry below --logpath for the location for mongod log. 

via mongo shell


mongo --host <hostname> --port <port number>

MongoDB Etnerprise> db.adminCommand('getCmdLineOpts')

/* 1 */
{
    "argv" : [ 
        "mongod", 
        "--port", 
        "21000", 
        "--replSet", 
        "avlrepdev", 
        "--dbpath", 
        "/data/mongodb/data", 
        "--logpath", 
        "/data/mongodb/log/mongodb.log", 
        "--logappend", 
        "--fork"
    ],
    "parsed" : {
        "net" : {
            "port" : 21000
        },
        "processManagement" : {
            "fork" : true
        },
        "replication" : {
            "replSet" : "avlrepdev"
        },
        "storage" : {
            "dbPath" : "/data/mongodb/data"
        },
        "systemLog" : {
            "destination" : "file",
            "logAppend" : true,
            "path" : "/data/mongodb/log/mongodb.log"
        }
    },
    "ok" : 1

}

Comments

Popular posts from this blog

MongoDB tip: 4 ways to modify replica set configuration

MongoDB Quick Note: BI Connector Issue

MongoDB Tips: Kill long running processes