Enabling full-text query logging for MongoDB Atlas queries in Application Insights requires some configuration in both MongoDB Atlas and Application Insights. Here are the general steps to enable this feature:
Set up Application Insights: a. Create an Application Insights resource in Azure. b. Retrieve the Instrumentation Key for your Application Insights resource.
Configure MongoDB Atlas: a. Access your MongoDB Atlas project and navigate to the desired cluster. b. Go to the "Database Access" section and create a new database user with appropriate privileges. c. In the "Network Access" section, whitelist the IP addresses or ranges that should be allowed to connect to your MongoDB Atlas cluster.
Configure your application: a. Modify your application's connection string to include the username, password, and other necessary details for connecting to MongoDB Atlas. b. Update your application code to integrate with Application Insights. This usually involves adding the Application Insights SDK to your application and configuring it with the Instrumentation Key obtained in step 1b.
Enable query logging in MongoDB Atlas: a. Connect to your MongoDB Atlas cluster using a MongoDB client (e.g., MongoDB Shell, MongoDB Compass). b. Execute the following command to enable query logging:
shellCopy code db.setProfilingLevel(2)
Verify query logging: a. Execute some queries against your MongoDB Atlas cluster. b. Navigate to the "Logs" section in the MongoDB Atlas web interface and verify that the query text is being logged.
By following these steps, you should be able to enable full-text query logging for MongoDB Atlas queries in Application Insights. Remember to review the MongoDB Atlas and Application Insights documentation for more detailed information on configuring and using these services.