Where can i find logs about running mongoexport?

Hi, I want to create security alert for using mongoexport on a large amount of documents. I couldn’t find execution of mongoexport in the mongod.log. Does anyone know where can I find them?

Hi @Michel_Joe and welcome to the community!
If I remember correctly, the only logs you can find when mongoexport is done are the ones that are printed as output on the terminal.
The only thing you can do is to redirect them to a file.

If you want, I can do a test tomorrow morning to verify!

Regards

Thank you @Fabio_Ramohitaj. Regrding the DB, do you know if a specific process run on the hosting machine when running mongoexport, or does it come off as a regular command on the server side?

Hi @Michel_Joe,
If I understand the question correctly, the answer should be as follows.
on the server side where your mongod instance resides you can see a slow operation’s series:

{"t":{"$date":"2024-01-13T12:02:05.868+01:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"conn6890","msg":"Slow query","attr":{"type":"command","ns":"twitter.twitter_collection","appName":"mongodump","command":{"getMore":6266519318610825397,"collection":"twitter_collection","lsid":{"id":{"$uuid":"10c7b76e-2a1f-4426-8d2a-eec371311bea"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1705447004,"i":6685}},"signature":{"hash":{"$binary":{"base64":"PUJ2EKNvY2uWWZIAFg4aGCdo9gY=","subType":"0"}},"keyId":7280767374075101190}},"$db":"twitter","$readPreference":{"mode":"primaryPreferred"}},"originatingCommand":{"find":"twitter_collection","filter":{},"lsid":{"id":{"$uuid":"10c7b76e-2a1f-4426-8d2a-eec371311bea"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1705447004,"i":6669}},"signature":{"hash":{"$binary":{"base64":"PUJ2EKNvY2uWWZIAFg4aGCdo9gY=","subType":"0"}},"keyId":7280767374075101190}},"$db":"twitter","$readPreference":{"mode":"primary"}},"planSummary":"COLLSCAN","cursorid":6266519318610825397,"keysExamined":0,"docsExamined":6413,"cursorExhausted":true,"numYields":10,"nreturned":6414,"reslen":13794777,"locks":{"FeatureCompatibilityVersion":{"acquireCount":{"r":11}},"ReplicationStateTransition":{"acquireCount":{"w":11}},"Global":{"acquireCount":{"r":11}},"Database":{"acquireCount":{"r":11}},"Collection":{"acquireCount":{"r":11}},"Mutex":{"acquireCount":{"r":1}}},"storage":{"data":{"bytesRead":13961910,"timeReadingMicros":167457}},"protocol":"op_msg","durationMillis":186}}

From the host machine from which you run the dump:

2024-03-10T21:47:09.503+0100    writing admin.system.users to archive 'test.archive'
2024-03-10T21:47:09.508+0100    done dumping admin.system.users (2 documents)
2024-03-10T21:47:09.509+0100    writing admin.system.version to archive 'test.archive'
2024-03-10T21:47:09.513+0100    done dumping admin.system.version (2 documents)
2024-03-10T21:47:09.516+0100    writing twitter.twitter_collection to archive 'test.archive'
2024-03-10T21:47:09.522+0100    writing student.studentCollection to archive 'test.archive'
2024-03-10T21:47:09.535+0100    done dumping student.studentCollection (2 documents)
2024-03-10T21:47:12.316+0100    [........................]  twitter.twitter_collection  62480/1984049  (3.1%)
2024-03-10T21:47:15.315+0100    [#.......................]  twitter.twitter_collection  116998/1984049  (5.9%)
2024-03-10T21:47:18.316+0100    [##......................]  twitter.twitter_collection  187080/1984049  (9.4%)
2024-03-10T21:47:21.315+0100    [###.....................]  twitter.twitter_collection  303920/1984049  (15.3%)
2024-03-10T21:47:24.316+0100    [####....................]  twitter.twitter_collection  366183/1984049  (18.5%)
2024-03-10T21:47:27.316+0100    [#####...................]  twitter.twitter_collection  428290/1984049  (21.6%)
2024-03-10T21:47:32.616+0100    [#####...................]  twitter.twitter_collection  459007/1984049  (23.1%)
2024-03-10T21:47:33.317+0100    [#####...................]  twitter.twitter_collection  468322/1984049  (23.6%)
2024-03-10T21:47:36.316+0100    [######..................]  twitter.twitter_collection  529474/1984049  (26.7%)
2024-03-10T21:47:39.316+0100    [#######.................]  twitter.twitter_collection  591703/1984049  (29.8%)
2024-03-10T21:47:42.315+0100    [#######.................]  twitter.twitter_collection  646130/1984049  (32.6%)
2024-03-10T21:47:45.316+0100    [########................]  twitter.twitter_collection  716097/1984049  (36.1%)
2024-03-10T21:47:48.316+0100    [#########...............]  twitter.twitter_collection  762856/1984049  (38.4%)
2024-03-10T21:47:51.318+0100    [#########...............]  twitter.twitter_collection  825163/1984049  (41.6%)
2024-03-10T21:47:54.317+0100    [##########..............]  twitter.twitter_collection  879661/1984049  (44.3%)
2024-03-10T21:47:57.316+0100    [###########.............]  twitter.twitter_collection  942020/1984049  (47.5%)
2024-03-10T21:48:00.316+0100    [############............]  twitter.twitter_collection  1004258/1984049  (50.6%)
2024-03-10T21:48:03.317+0100    [############............]  twitter.twitter_collection  1058717/1984049  (53.4%)
2024-03-10T21:48:06.315+0100    [#############...........]  twitter.twitter_collection  1121181/1984049  (56.5%)
2024-03-10T21:48:09.315+0100    [##############..........]  twitter.twitter_collection  1183544/1984049  (59.7%)
2024-03-10T21:48:12.316+0100    [###############.........]  twitter.twitter_collection  1245722/1984049  (62.8%)
2024-03-10T21:48:15.322+0100    [###############.........]  twitter.twitter_collection  1292520/1984049  (65.1%)
2024-03-10T21:48:18.316+0100    [################........]  twitter.twitter_collection  1354844/1984049  (68.3%)
2024-03-10T21:48:21.316+0100    [#################.......]  twitter.twitter_collection  1417210/1984049  (71.4%)
2024-03-10T21:48:24.316+0100    [#################.......]  twitter.twitter_collection  1479565/1984049  (74.6%)
2024-03-10T21:48:27.317+0100    [##################......]  twitter.twitter_collection  1534016/1984049  (77.3%)
2024-03-10T21:48:30.320+0100    [###################.....]  twitter.twitter_collection  1596228/1984049  (80.5%)
2024-03-10T21:48:33.317+0100    [####################....]  twitter.twitter_collection  1656027/1984049  (83.5%)
2024-03-10T21:48:36.316+0100    [####################....]  twitter.twitter_collection  1705222/1984049  (85.9%)
2024-03-10T21:48:39.315+0100    [#####################...]  twitter.twitter_collection  1759700/1984049  (88.7%)
2024-03-10T21:48:42.315+0100    [#####################...]  twitter.twitter_collection  1814252/1984049  (91.4%)
2024-03-10T21:48:45.316+0100    [######################..]  twitter.twitter_collection  1860946/1984049  (93.8%)
2024-03-10T21:48:48.318+0100    [#######################.]  twitter.twitter_collection  1923208/1984049  (96.9%)
2024-03-10T21:48:51.087+0100    [########################]  twitter.twitter_collection  1984049/1984049  (100.0%)
2024-03-10T21:48:51.088+0100    done dumping twitter.twitter_collection (1984049 documents)
top - 21:47:17 up 21 min,  3 users,  load average: 0,00, 0,04, 0,05
Threads: 137 total,   1 running, 136 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3,7 us,  7,4 sy,  0,0 ni, 88,9 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Mem :  1881928 total,  1163416 free,   261708 used,   456804 buff/cache
KiB Swap:  1048572 total,  1048572 free,        0 used.  1468088 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 3100 root      20   0 1008416 108344   5520 S 20,0  5,8   0:00.64 mongodump
 3095 root      20   0 1008416 108344   5520 S 13,3  5,8   0:00.42 mongodump

Best Regards