Updated on 2025-06-19 GMT+08:00

API for Reporting 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.

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

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Value length: 32 characters

log_group_id

Yes

String

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

Value length: 36 characters

log_stream_id

Yes

String

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

Value length: 36 characters

A write rate exceeding 100 MB/s per log stream may cause log losses.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

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

Minimum length: 1,000 characters

Maximum length: 2,000 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

log_time_ns

Yes

Long

Time when log data is reported (UTC time in nanoseconds).

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.

contents

Yes

Array of String

Log content.

labels

Yes

Object

Custom labels.

Do not set field names to system reserved fields. Otherwise, problems such as duplicate field names and inaccurate query may occur.

tenant_project_id

No

String

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

Response Parameters

When the status code is 200, the response parameters are as follows:

Table 4 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

error_msg

String

Error message.

result

String

Response result.

When the status code is 400, the response parameters are as follows:

Table 5 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

error_msg

String

Error message.

result

String

Response result.

When the status code is 401, the response parameters are as follows:

Table 6 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

error_msg

String

Error message.

result

String

Response result.

When the status code is 500, the response parameters are as follows:

Table 7 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

error_msg

String

Error message.

result

String

Response result.

When the status code is 503, the response parameter is as follows:

Table 8 Response body parameter

Parameter

Type

Description

result

String

The requested service is unavailable.

Example Request

POST https://{access_IP_address:8102}/v2/{project_id}/lts/groups/{log_group_id}/streams/{log_stream_id}/tenant/contents

{
	"log_time_ns": 1586850540000000000,
	"contents": [
		"Fri Feb  1 07:48:04 UTC 2019 0\n",
		"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.