API for Reporting High-Precision Logs
Function
This API is used to report tenant logs from a host to LTS.
The access IP address is contained in the ICAgent installation command displayed on the LTS console. The port number is 8102. You can check the Example Request to see how to add the access IP address and port number in a request.
Each log event will carry a nanosecond-level timestamp when it is reported. When you view logs on the LTS console, the log events are sorted by timestamp. For details about the constraints on log reporting, see Log Read/Write Constraints.
URI
POST /v2/{project_id}/lts/groups/{log_group_id}/streams/{log_stream_id}/tenant/contents/high-accuracy
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| log_group_id | Yes | String | Definition Log group ID. For details about how to obtain it, see Obtaining Log Group and Log Stream IDs. Constraints N/A Range N/A Default Value N/A |
| log_stream_id | Yes | String | Definition Log stream ID. For details about how to obtain it, see Obtaining Log Group and Log Stream IDs. Constraints A write rate exceeding 100 MB/s per log stream may cause log losses. Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. Constraints N/A Range N/A Default Value N/A |
| Content-Type | Yes | String | Definition Message body format. Set this parameter to application/json;charset=UTF-8. Constraints N/A Range N/A Default Value N/A |
| Content-Encoding | No | String | Definition Log compression format. Constraints N/A Range
Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| contents | Yes | Array of LogContents | Definition Indicates a list of log events that carry reporting timestamps. Constraints N/A |
| labels | Yes | Object | Definition Custom labels. Do not set field names to be the same as system reserved fields. Otherwise, problems such as duplicate field names and inaccurate query may occur. Constraints N/A |
| tenant_project_id | No | String | Definition Tenant project ID. For details about how to obtain it, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| log_time_ns | Yes | Long | Definition Time when log data is reported (UTC time in nanoseconds). Constraints When logs are reported to LTS via APIs, the time difference between the log reporting time you set and the current time must not exceed two days. Otherwise, the reported logs will be deleted by LTS. Range N/A Default Value N/A |
| log | Yes | String | Definition Log content. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| result | String | Definition Response result. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| result | String | Definition Response result. Range N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| result | String | Definition Response result. Range N/A |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
| result | String | Definition Response result. Range N/A |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| result | String | Definition The requested service is unavailable. Range N/A |
Example Request
POST https://{access_IP_address:8102}/v2/{project_id}/lts/groups/{log_group_id}/streams/{log_stream_id}/tenant/contents/high-accuracy
{
"contents": [
{
"log_time_ns": 1586850540000000000,
"log": "Fri Feb 15 15:48:04 UTC 2019"
},
{
"log_time_ns": 1586850540000000001,
"log": "Sat April 18 16:04:04 UTC 2019"
}
],
"labels": {
"user_tag": "string"
}
} Example Response
Example response with status code 200:
Logs are reported.
{
"errorCode": "SVCSTG.ALS.200.200",
"error_msg": "Report success.",
"result": null
} Example response with status code 401:
The authorization information provided by the client is incorrect or invalid.
{
"errorCode" : "SVCSTG.ALS.403.105",
"error_msg" : "Project id is invalid.",
"result": null
} Status Code
| Status Code | Description |
|---|---|
| 200 | Logs are reported. |
| 400 | The request is invalid. Modify the request based on the description in error_msg before a retry. |
| 401 | The authorization information provided by the client is incorrect or invalid. |
| 500 | An internal error occurred. |
| 503 | The requested service is unavailable. |
What is your overall rating for this page?
Thank 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