Querying the Log Histogram
Function
Query the number of results returned by keyword.
URI
POST /v2/{project_id}/lts/keyword-count
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining the Account Tenant ID, Log Group ID, and Log Stream ID. Default: None Minimum: 32 Maximum: 32 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. Default: None Minimum: 1000 Maximum: 2000 |
Content-Type |
Yes |
String |
Set this parameter to application/json;charset=UTF-8. Default: None Minimum: 30 Maximum: 30 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_time |
Yes |
String |
Start time of the query (UTC, in milliseconds). Minimum: 13 Maximum: 13 |
end_time |
Yes |
String |
End time of the query (UTC, in milliseconds). Minimum: 13 Maximum: 13 |
step_interval |
Yes |
Long |
Time step in milliseconds (ms). Recommended formula: (end_time-start_time)/1000 x 1000/60, where /1000 x 1000 means rounding to an integer. Note: If the calculated result is less than or equal to 1000, the value 1000 is used. |
group_id |
Yes |
String |
Log group ID. Minimum: 36 Maximum: 36 |
stream_id |
Yes |
String |
Log stream ID. Minimum: 36 Maximum: 36 |
key_word |
Yes |
String |
A keyword is a word between two adjacent delimiters. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
count |
Long |
Number of logs. |
histogram |
String |
Histogram result. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
Querying the Log Histogram
POST https://{endpoint}/v2/{project_id}/lts/keyword-count { "group_id" : "00330565-5baf-4e0d-bd16-ba0c6b951d9a", "stream_id" : "715cda3b-e17f-492a-a6ca-98a1ba16ad8c", "end_time" : 1637820813605, "start_time" : 1637817213605, "key_word" : "test", "step_interval" : 6000 }
Example Responses
Status code: 200
The request is successful.
{ "count" : 1, "histogram" : "[{\"num\":1,\"startTime\":1637821594579,\"endTime\":1637821595000}{\"num\":0,\"startTime\":1637821654000,\"endTime\":1637821654579}]" }
Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{ "error_code" : "LTS.0601", "error_msg" : "must be less than or equal to 86400000" }
Status Codes
Status Code |
Description |
---|---|
200 |
The request is successful. |
400 |
Invalid request. Modify the request based on the description in error_msg before a retry. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot