Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ GeminiDB/ API Reference/ APIs v3 (Recommended)/ Logs/ Querying Slow Query Logs of a GeminiDB Mongo Instance

Querying Slow Query Logs of a GeminiDB Mongo Instance

Updated on 2024-08-08 GMT+08:00

Function

This API is used to query slow query logs of GeminiDB Mongo instances. Searching for slow query logs by keyword is supported.

Constraints

  • The following operators are not supported: &&, ||, AND, OR, NOT, *, ?, :, >, <, =, ≥, and ≤
  • The query must be within the period specified by start_time and end_time.
  • The value of line_num must be obtained from the log information returned for the last query. This parameter is optional for the first query.
  • A maximum of 100 records can be queried on each page, and slow query logs can be stored for a maximum of 30 days.

URI

POST https://{Endpoint}/v3/{project_id}/mongodb/instances/{instance_id}/slow-logs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

start_time

Yes

String

Start time in the yyyy-mm-ddThh:mm:ssZ format. T is the separator between calendar and hourly notation of time. Z indicates the time zone offset. The start time cannot be 30 days earlier than the current time.

end_time

Yes

String

End time in the yyyy-mm-ddThh:mm:ssZ format. T is the separator between calendar and hourly notation of time. Z indicates the time zone offset. The end time cannot be later than the current time.

limit

Yes

Integer

Number of logs to be queried each time. The maximum value is 100.

line_num

No

String

Sequence number of a log event. This parameter is not required for the first query, but is required for the next query. The value can be obtained from the response of the last query. The current query starts from the next log of line_num, excluding the log of line_num.

operate_type

No

String

Statement type. If this parameter is left empty, all statement types are queried.

Value options:

  • insert
  • query
  • update
  • remove
  • getmore
  • command
  • killcursors

node_id

No

String

Node ID. If this parameter is left blank, all nodes in the instance can be queried. For details about the value, see field id in Table 10.

keywords

No

Array of strings

Full-text log search based on multiple keywords, indicating that all keywords are matched.

  • A maximum of 10 keywords are supported.
  • Each keyword can contain a maximum of 512 characters.

database_keywords

No

Array of strings

Fuzzy search for logs based on multiple database name keywords, indicating that at least one keyword is matched.

  • Only fuzzy search by keyword prefix is supported. A maximum of 10 keywords are supported.
  • Each keyword can contain a maximum of 64 characters.

collection_keywords

No

Array of strings

Fuzzy search for logs based on multiple database collection name keywords, indicating that at least one keyword is matched.

  • Only fuzzy search by keyword prefix is supported. A maximum of 10 keywords are supported.
  • Each keyword can contain a maximum of 128 characters.

max_cost_time

No

Integer

Logs can be searched based on the maximum execution duration. Unit: ms

min_cost_time

No

Integer

Logs can be searched based on the minimum execution duration. Unit: ms

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

slow_logs

Array of objects

Slow log information. For details, see Table 5.

Table 5 MongodbSlowLogDetail

Parameter

Type

Description

node_name

String

Node name.

node_id

String

Node ID.

whole_message

String

Statement.

operate_type

String

Statement type.

cost_time

Integer

Execution time. Unit: ms

lock_time

Integer

Lock wait time. Unit: μs

docs_returned

Integer

Number of documents returned by a slow query.

docs_scanned

Integer

Number of documents scanned during a slow query.

database

String

Database name.

collection

String

Database collection name.

log_time

String

UTC time when a log is generated. The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between calendar and hourly notation of time. Z indicates the time zone offset.

line_num

String

Sequence number of a log event.

Example Requests

POST https://{Endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/mongodb/instances/916de02c35fe4abaa3e707ebd916d3f8in10/slow-logs 
 
{ 
  "start_time" : "2021-01-06T10:41:14+0800", 
  "end_time" : "2023-01-10T10:41:14+0800", 
  "limit" : 100, 
  "line_num" : "1595659490239433658", 
  "operate_type" : "query", 
  "node_id" : "dfe41edcb2a1483c96ddf61cc0cee237no10", 
  "keywords" : [ "response", "oplog" ], 
  "database_keywords" : [ "testDB", "system_auth" ], 
  "collection_keywords" : [ "testCollection" ], 
  "max_cost_time" : 100, 
  "min_cost_time" : 50 
}

Example Responses

Status code: 200

Success

{ 
  "slow_logs" : [ { 
    "node_name" : "test_replica_node_1", 
    "node_id" : "dfe41edcb2a1483c96ddf61cc0cee237no10", 
    "database" : "testDB", 
    "collection" : "testCollection", 
    "whole_message" : "{\\\"responseLength\\\": 230, \\\"ts\\\": {\\\"$date\\\": 1605480486800}, \\\"ninserted\\\": 1, \\\"locks\\\": {\\\"oplog\\\": {\\\"acquireCount\\\": {\\\"w\\\": 1}}, \\\"Global\\\": {\\\"acquireCount\\\": {\\\"r\\\": 3, \\\"w\\\": 2}}, \\\"Collection\\\": {\\\"acquireCount\\\": {\\\"w\\\": 2}}, \\\"Database\\\": {\\\"acquireCount\\\": {\\\"w\\\": 3}}}, \\\"numYield\\\": 0, \\\"ns\\\": \\\"geographySpace.tiles\\\"}", 
    "operate_type" : "query", 
    "cost_time" : 60, 
    "lock_time" : 10, 
    "docs_returned" : 0, 
    "docs_scanned" : 0, 
    "log_time" : "2023-01-09T06:42:32.000+0000", 
    "line_num" : "1595659490239433659" 
  } ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback