mongodb startup logs

137 views
Skip to first unread message

roshni chatterjee

unread,
Jan 31, 2017, 8:01:37 AM1/31/17
to mongodb-user
Hi I am a novice mongodb user . 
I am trying to understand it from the development point of view .

Can someboy help me with how to get the mongodb startup logs .
I mean the logs when the system is started and automatically starts mongo daemon to the time I connect using mongo shell .

Environment Linux 
Ubuntu 14.04 

the logs at the path  /var/log/mongodb/mongodb.log  didno thelp me ...
I need the initializer logs for mongodb .

Regards,
Roshni  

Attila Tozser

unread,
Jan 31, 2017, 9:15:09 AM1/31/17
to mongod...@googlegroups.com
More or less you can use more or less.

Bit more seriously it is just a text file. You can read it by any suitable tool from command line. 

In case your question specificly the startup you can grep for : [initandlisten] 

2017-01-31T14:51:34.513+0100 I CONTROL  [initandlisten] MongoDB starting : pid=9787 port=27017 dbpath=./db 64-bit host=attish-ThinkPad-T510
2017-01-31T14:51:34.513+0100 I CONTROL  [initandlisten] db version v3.5.1-193-g9eef4e6
2017-01-31T14:51:34.513+0100 I CONTROL  [initandlisten] git version: 9eef4e66adb645120491a3a79e705f7594af869a

If you do not have a way to access the logfile from the commandline
all the info ( i think except the warnings ) you can find in the local database startup_log collection.

and there is a command which you can use to read the recent loglines:

set1:PRIMARY> db.adminCommand({getLog: "*" })
{ "names" : [ "global", "rs", "startupWarnings" ], "ok" : 1 }
set1:PRIMARY> db.adminCommand({getLog: "global" })
{
"totalLinesWritten" : 54,
"log" : [
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] MongoDB starting : pid=9958 port=27017 dbpath=./db 64-bit host=attish-ThinkPad-T510",
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] db version v3.5.1-193-g9eef4e6",
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] git version: 9eef4e66adb645120491a3a79e705f7594af869a",
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] allocator: tcmalloc",
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] modules: none",
"2017-01-31T14:54:21.565+0100 I CONTROL  [initandlisten] build environment:",

Actually i am not sure how much data it can return,

to get the startup warnings:

set1:PRIMARY> db.adminCommand({getLog: "startupWarnings" })
{
"totalLinesWritten" : 17,
"log" : [
"2017-01-31T14:54:21.585+0100 I STORAGE  [initandlisten] ",
"2017-01-31T14:54:21.585+0100 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine",
"2017-01-31T14:54:21.585+0100 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem",
"2017-01-31T14:54:28.778+0100 I CONTROL  [initandlisten] ",
"2017-01-31T14:54:28.778+0100 I CONTROL  [initandlisten] ** NOTE: This is a development version (3.5.1-193-g9eef4e6) of MongoDB.",
"2017-01-31T14:54:28.778+0100 I CONTROL  [initandlisten] **       Not recommended for production.",

which with you can find out when your mongod started to check the rest of the logs in the logfile.
on the other hand the rest of the information even the startup process is accessing through internal commands 






--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/c459819d-7db3-4e78-98bf-8c1a37690a62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

roshni chatterjee

unread,
Jan 31, 2017, 9:30:33 AM1/31/17
to mongod...@googlegroups.com

This is not what I want...this is available .. I want the startup sequence from the networking view...I once we trigger
sudo service mongod start..what happens in the kernel where aviha daemon . Network manager etc comes into play..
If you have any information regarding that sequence it would be helpful

Regards,
Roshni


Attila Tozser

unread,
Jan 31, 2017, 10:30:53 AM1/31/17
to mongod...@googlegroups.com
I would try Ftrace https://lwn.net/Articles/365835/ but depends on what you would like to see. 

you can strace: https://linux.die.net/man/1/strace also individual components like mongod

Reply all
Reply to author
Forward
0 new messages