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
Help Center/ Log Tank Service/ More Documents/ API Reference (Ankara Region)/ APIs/ Resource Statistics/ Collecting Traffic Statistics on Top N Log Groups or Log Streams

Collecting Traffic Statistics on Top N Log Groups or Log Streams

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

Function

Collect traffic statistics on top N log groups or log streams.

URI

POST /v2/{project_id}/lts/topn-traffic-statistics

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.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Minimum length: 1000 characters.

Maximum length: 2000 characters.

Content-Type

Yes

String

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

Minimum length: 30 characters.

Maximum length: 30 characters.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

end_time

Yes

Long

End timestamp, in milliseconds.

is_desc

Yes

Boolean

Whether to sort data in descending order (true or false).

resource_type

Yes

String

Resource type: The value is log_group / log_stream / tenant.

sort_by

Yes

String

Sorting criteria: index, write, or storage. The value must exist in search_list.

start_time

Yes

Long

Start timestamp of the query, in milliseconds. A maximum of 30 days are supported.

topn

Yes

Integer

Number of data records to be queried. The value ranges from 1 to 100.

filter

Yes

Map<String,String>

Filter criteria { "log_group_id": "xxxxxx" }Filter is in the map structure. The key is the filtering attribute, and the value is the attribute value. Fuzzy match is not supported.

search_list

Yes

Array of strings

Query data type. Multiple string arrays can be used together. This parameter can be set only to index, write, or storage.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

results

Array of ResultsTopnBody objects

Response result.

Table 5 ResultsTopnBody

Parameter

Type

Description

index_traffic

Double

Index traffic, in bytes. This parameter is returned when the queried data type contains index.

storage

Double

Storage capacity, in bytes. This parameter is returned when the queried data type contains storage.

write_traffic

Double

Write traffic, in bytes. This parameter is returned when the queried data type contains write.

log_group_id

String

Log group ID. This parameter is returned when the resource type is log group.

log_group_name

String

Log group name. This parameter is returned when the resource type is log group.

log_stream_id

String

Log stream ID. This parameter is returned when the resource type is log stream.

log_stream_name

String

Log stream name. This parameter is returned when the resource type is log stream.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

errorCode

String

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

errorMessage

String

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

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

errorCode

String

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

errorMessage

String

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

Example Requests

/v2/2a473356cca5487f8373be891bffc1cf/lts/topn-traffic-statistics

{
  "sort_by" : "storage",
  "is_desc" : true,
  "resource_type" : "log_stream",
  "filter" : { },
  "start_time" : 1668668183969,
  "end_time" : 1669272983969,
  "search_list" : [ "index", "write", "storage" ],
  "topn" : 100
}

Example Responses

Status code: 200

Query succeeded.

{
  "results" : [ {
    "index_traffic" : 0,
    "log_stream_id" : "6fd93d47-7630-4284-a622-311d0082f6bb",
    "log_stream_name" : "cmdb-cce-cluster",
    "storage" : 59810657587,
    "write_traffic" : 0
  }, {
    "index_traffic" : 0,
    "log_stream_id" : "504ec3dd-ac28-4783-babb-22a49f36afe3",
    "log_stream_name" : "CMSkaifatest",
    "storage" : 20033606015,
    "write_traffic" : 0
  }, {
    "index_traffic" : 6825703991,
    "log_stream_id" : "a14dacb0-5a13-43a8-89a3-ea5424d95133",
    "log_stream_name" : "ELB",
    "storage" : 15659303771,
    "write_traffic" : 1.3651407982E9
  }, {
    "index_traffic" : 302172889,
    "log_stream_id" : "25fe7494-7395-438e-8340-647613673ffa",
    "log_stream_name" : "LTStest-916-statefulset",
    "storage" : 316552589,
    "write_traffic" : 6.04345778E7
  }, {
    "index_traffic" : 0,
    "log_stream_id" : "956586fc-b828-44be-8672-0a323962a8fa",
    "log_stream_name" : "mongodb_slow",
    "storage" : 0,
    "write_traffic" : 0
  } ]
}

Status code: 400

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

{
  "errorCode" : "LTS.0208",
  "errorMessage" : "The log stream does not existed"
}

Status code: 500

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

{
  "errorCode" : "LTS.0203",
  "errorMessage" : "Internal Server Error"
}

Status Codes

Status Code

Description

200

Query 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