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
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

Querying Historical SQL Statements

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

Function

Query historical SQL statements.

URI

GET /v2/{project_id}/lts/history-sql

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Account ID, Project ID, Log Group ID, and Log Stream ID.

Minimum length: 1 character.

Maximum length: 64 characters.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

log_group_id

Yes

String

Log group ID.

log_stream_id

Yes

String

Log stream ID.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token.

Minimum length: 1 character.

Maximum length: 10,000 characters.

Content-Type

No

String

Set this parameter to application/json;charset=UTF-8.

Minimum length: 30 characters.

Maximum length: 30 characters.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

results

Array of QuertHistorySQLResultsBody objects

Return the result.

Table 5 QuertHistorySQLResultsBody

Parameter

Type

Description

last_use_time

Long

Last modification time. The value is a timestamp, in milliseconds.

sql_statement

String

Historical SQL statements.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

message

ErrorMessagebody object

Error message body.

Table 7 ErrorMessagebody

Parameter

Type

Description

code

String

Error code. Minimum length: 8 characters. Maximum length: 36 characters.

details

String

Error description. Minimum length: 2 characters. Maximum length: 512 characters.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

message

ErrorMessagebody object

Error message body.

Table 9 ErrorMessagebody

Parameter

Type

Description

code

String

Error code. Minimum length: 8 characters. Maximum length: 36 characters.

details

String

Error description. Minimum length: 2 characters. Maximum length: 512 characters.

Example Requests

/v2/2a473356cca5487f8373be891bffc1cf/lts/history-sql?log_group_id=d1f4240d-5ee2-4e0b-9e2c-e25c7978c001&log_stream_id=f3d853be-0576-4dff-aee9-c093e4924b63

Example Responses

Status code: 200

Query SQL statements succeeded.

{
  "results" : [ {
    "last_use_time" : 1669689650936,
    "sql_statement" : "SELECT *"
  }, {
    "last_use_time" : 1666775421613,
    "sql_statement" : "select count(\"t\") as pv"
  }, {
    "last_use_time" : 1666661494805,
    "sql_statement" : "SELECT count(\"time\")"
  }, {
    "last_use_time" : 1666598233252,
    "sql_statement" : "SELECT count(\"t\") as pv"
  }, {
    "last_use_time" : 1666598226763,
    "sql_statement" : "SELECT count(\"t\") "
  }, {
    "last_use_time" : 1666598222298,
    "sql_statement" : "SELECT count(\"t\") as pv"
  }, {
    "last_use_time" : 1666598221585,
    "sql_statement" : "SELECT count(\"t\") as p"
  }, {
    "last_use_time" : 1666598220276,
    "sql_statement" : "SELECT count(\"t\") as "
  }, {
    "last_use_time" : 1666598212453,
    "sql_statement" : "SELECT count(\"t\")"
  } ]
}

Status code: 400

Invalid request. Modify the request based on the description in error_msg before a retry.

{
  "message" : {
    "code" : "LTS.0603",
    "details" : "group or stream not exist"
  }
}

Status code: 500

The server has received the request but encountered an internal error.

{
  "message" : {
    "code" : "LTS.0203",
    "details" : "Internal Server Error"
  }
}

Status Codes

Status Code

Description

200

Query SQL statements succeeded.

400

Invalid request. Modify the request based on the description in error_msg before a retry.

500

The server has received the request but encountered an internal error.

Error Codes

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