I’m using mongodb 3.6.8 for log collection. I want to get only slow query and error level logs.

I set profilinglevel to (1, 5000), loglevel to 1 for queries only and 0 for everything else. However, looking at the log, more than 40 were being created like crazy per second. If query is set to 0, nothing is created.

One of the log entries...

2022-03-03T14:49:52.060+0900 D QUERY [conn196] Winning plan had zero results. Not caching. ns: graylog.grants query: { $or: [ { grantee: { $in: [ "grn::::user:local:admin" ] } }, { grantee: "grn::::builtin-team:everyone" } ] } sort: {} projection: {} winner score: 1.0003 winner summary: IXSCAN { grantee: 1, target: 1 }

As far as I know, profiling level 1 only records slow queries.

If you are simply concerned about a large amount of data, you can cut the log appropriately and delete it, but I am sending the log to a log collection tool in real time. The capacity of the server is also a problem, but the log accumulated in the log collection tool is also a problem, and it will be difficult to extract the desired information.

Is there any good way?:(



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.