I wanted in the first place to log connections to a collection and while I was searching I found that it's possible to configure profiling and auditing and logging.
So my question is : What's the difference between the 3 and when to use which?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
Profiling collects information about "what, when and how information was queried + how much time it took + what was DB engines solution"
Auditing tell "who did what and when" (who red/accessed f.ex. user information)
Logging is higher level information telling what DB did and when. When client makes/closes connection, new index is created, data is replicated, engine errors happened...
So, if law says that "we need to know who (as a person) accessed specific information", you do auditing.
To find out "which queries are slowest/take time and WHY" you use profiling.
To know what's happening and what are errors on database level, you use log files.