문서 메뉴
문서 홈
/
MongoDB 매뉴얼
/ / / /

$queryStats 로그 출력 토글

이 페이지의 내용

  • 이 작업에 대하여
  • 단계
  • 예제
  • 자세히 알아보기

MongoDB는 $queryStats 배포 로그 에 작업을 기록합니다. 기본적으로 MongoDB는 작업의 호출만 기록하고 $queryStats 작업 출력은 기록하지 않습니다.$queryStats transformIdentifiers 옵션이 포함된 작업의 경우 변환된 출력을 로그 항목에 포함할지 여부를 지정할 수 있습니다.

로그에 $queryStats 출력을 포함하면 특정 $queryStats 작업에 대한 자세한 정보를 제공할 수 있지만 로그 업데이트에 더 많은 시간과 리소스가 소요되므로 클러스터 성능에 부정적인 영향을 미칠 수 있습니다.

MongoDB가 $queryStats 출력을 기록하면 결과가 수정되고 익명화됩니다. $queryStats 출력에 리터럴 또는 필드 값이 포함되어 있지 않습니다.

변환된 $queryStats 출력의 예는 변환된 예제를 참조하세요 .

1
  1. 이미 표시되어 있지 않은 경우 탐색 모음의 Organizations 메뉴에서 원하는 프로젝트가 포함된 조직을 선택합니다.

  2. 아직 표시되지 않은 경우 내비게이션 바의 Projects 메뉴에서 프로젝트를 선택합니다.

  3. Clusters 페이지가 아직 표시되지 않은 경우 사이드바에서 Database를 클릭합니다.

    클러스터 페이지가 표시됩니다.

2
3
4
5
6
7
8

다음 예는 $queryStats 출력이 포함될 때 로그 메시지의 차이점을 보여줍니다.

참고

로그 항목 예시는 가독성을 위해 서식이 변경되었습니다.

{
"t":{"$date":"2023-11-27T20:58:59.212+00:00"},"s":"D1", "c":"QRYSTATS",
"id":7808300, "ctx":"conn31","msg":"Logging invocation
$queryStats","attr":{"commandSpec":{"transformIdentifiers":{"algorithm":"hmac-sha-256","hmacKey":"###"}}
}
{
"t":{"$date":"2023-11-27T20:58:59.212+00:00"},"s":"D1", "c":"QRYSTATS",
"id":7808300, "ctx":"conn31","msg":"Logging invocation
$queryStats","attr":{"commandSpec":{"transformIdentifiers":{"algorithm":"hmac-sha-256","hmacKey":"###"}}
}
{
"t":{"$date":"2023-11-27T20:58:59.212+00:00"},"s":"D3", "c":"QRYSTATS",
"id":7808301, "ctx":"conn31","msg":"Logging all outputs of
$queryStats","attr":{"thisOutput":"{key: {queryShape: {cmdNs: {db:
\"hYt+nW/sr1/Zc3YR8nlGWFoesJdvywkw+cR9rMGzXU4=\", coll:
\"TRx6R3rvstYgX96gNmeOi5E3QVsOqzRbv7A9j3q7OvM=\"}, command: \"find\",
filter: {Wb/Uu22DzKZ/Os+ZvLgPKFKGZPV4cIMZ3Ybv1HfYih4=: {$lt:
\"?date\"}}, projection: {r5zQZllsGoqQuQp4Jm0eH2M6RrMqH84KHowcFaiverg=:
true}, sort: {r5zQZllsGoqQuQp4Jm0eH2M6RrMqH84KHowcFaiverg=: 1}},
readConcern: {}, collectionType: \"nonExistent\"}, metrics:
{lastExecutionMicros: 208, execCount: 21, totalExecMicros: {sum: 6079,
max: 1875, min: 198, sumOfSquares: 4401645}, firstResponseExecMicros:
{sum: 6079, max: 1875, min: 198, sumOfSquares: 4401645}, docsReturned:
{sum: 0, max: 0, min: 0, sumOfSquares: 0}, firstSeenTimestamp:
2023-11-27T19:15:51.317Z, latestSeenTimestamp:
2023-11-27T20:55:51.309Z}, asOf: 2023-11-27T20:58:59.212Z}"}
}
{
"t":{"$date":"2023-11-27T20:58:59.213+00:00"},"s":"D3", "c":"QRYSTATS",
"id":7808301, "ctx":"conn31","msg":"Logging all outputs of
$queryStats","attr":{"thisOutput":"{key: {queryShape: {cmdNs: {db:
\"j+Caz+gxt7vl++gmeCAWrvyhDL17WaNrSIDi6Au7VI0=\", coll:
\"f/LCkK/kVEbt4fk2NNbyDPhxas+kzCLLcVbjeNBbhyg=\"}, let:
{pUZAyEEImSXcu8deG05tfIf6F/H92YsFnkZXIeRQtgc=: \"?number\"}, command:
\"aggregate\", pipeline: [{$group: {_id: \"?number\",
5E6FSc5VxCvIZK0jrqkY3k3aX51jSc73hQwO/8kH0lo=: {$sum: \"?number\"}}}],
explain: true, allowDiskUse: false}, client: {driver: {name:
\"nodejs|mongosh\", version: \"5.1.0\"}, os: {type: \"Darwin\", name:
\"darwin\", architecture: \"arm64\", version: \"22.6.0\"}, platform:
\"Node.js v16.19.1, LE (unified)\", version: \"5.1.0|1.8.0\",
application: {name: \"mongosh 1.8.0\"}}, collectionType: \"collection\",
cursor: {batchSize: \"?number\"}}, metrics: {lastExecutionMicros: 0,
execCount: 1, totalExecMicros: {sum: 0, max: 0, min: 0, sumOfSquares:
0}, firstResponseExecMicros: {sum: 0, max: 0, min: 0, sumOfSquares: 0},
docsReturned: {sum: 0, max: 0, min: 0, sumOfSquares: 0},
firstSeenTimestamp: 2023-11-27T19:31:36.463Z, latestSeenTimestamp:
2023-11-27T19:31:36.463Z}, asOf: 2023-11-27T20:58:59.213Z}"}
}
// Additional $queryStats output...

돌아가기

$queryStats