1

I am new to mongodb and trying to figure out a lot.

Can we configure shell logging for mongodb? What I mean is the capability to get logs from the Shell to track queries for auditing purposes for version 4?

If so - what commands do we have to run please?

Thank you for your help

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nchang
  • 11
  • 1
  • There are two versions of MongoDB shell: the newer `mongosh` and the `mongo` shell. The `mongosh` has its logs at [Retrieve Shell Logs](https://docs.mongodb.com/mongodb-shell/logs/). – prasad_ Sep 30 '21 at 02:03
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – dhpratik Oct 07 '21 at 12:16

1 Answers1

0

There are two versions of MongoDB shell: the newer mongosh and the older/legacy mongo shell.

mongo maintains a history of commands in the .dbshell file. For example, in the Windows 7 environment this can be found at the folder: C:\Users\<user_name>

MongoDB Shell mongosh stores logs for each session and can be retrieved as explained at: Retrieve Shell Logs. For example, in Windows environment this can be found at the folder: C:\Users\<user_name>\AppData\Local\. The log files are of the format <LogID>_log.

prasad_
  • 12,755
  • 2
  • 24
  • 36