Posts

Showing posts from March, 2019

Linux Tips: rsyslogd

This is a quick demo of how to use rsyslogd, I intended to capture whether or not my cron job did execute. First make sure rsyslogd is installed, this can be referenced  here run in shell rsyslogd as soon as it ran, we can tail syslog tail -f /var/log/syslog <sample output> Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.219761] XFS (dm-17): Ending clean mount Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.464436] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.474570] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.475096] docker0: port 7(vethrfcdcac393a) entered blocking state Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.475101] docker0: port 7(vethrfcdcac393a) entered disabled state Mar 15 11:13:49 mongodb-enterprise-mongo-1 kernel: [21412388.475197] device vet...

MongoDB Tips: Kill long running processes

This is just a quick and simple script to find all active opid that has been running over 10 seconds and they are running against the databases and collections you can specify in the "ns" filter. It's best to first run db.currentOp(    {      "active" : true,      "secs_running" : { "$gt" : 10 },      "ns" : {$in:["equipment.detachment","personnel.detail","personnel.unavailability","personnel.detachment"]}    } ).inprog.forEach(function (doc) { print(doc.opid); }) and verify your output before you execute the kill command in my experience to make sure you are killing the processes that are meant to be killed. Once verifed, simply run: db.currentOp(    {      "active" : true,      "secs_running" : { "$gt" : 10 },      "ns" : {$in:["<db1>.<col1>","<db2>.<col2>","<dbn>.<coln>...