- Documentation
Torch Log Service
API reference
Log management API
PutLogs
Log management API
PutLogs
PutLogs
Call the PutLogs interface to upload logs to the specified topic.
This interface is used to upload structured logs to the specified log topic. Currently, only PB format is supported (Protocol Buffer), the log data is displayed in the form of a log group. Please refer to TLS PB format Data encoding method. When uploading logs, writing is supported through load balancing mode and HashKey routing shard mode.
- HashKey routing shard mode: when writing logs, data is written to the specified shard in an orderly manner. It is suitable for scenarios that require high orderliness for data writing and consumption. For example, a certain producer can be hashed to the shard based on the name, thus ensuring that the data written and consumed on this shard is strictly in order. Even during the merging and splitting process, it can strictly ensure that the Key will only appear on one shard at a time.
- At this time, you need to set a HashKey. TLS will write the data into the shard that contains this key value. The range of HashKey values is [00000000000000000000000000000000-ffffffffffffffffffffffffffffffff).
- Load balancing mode: Automatically write data packets to any currently available shard according to the principle of load balance. This mode is suitable for scenarios where write and consumption behavior is independent of the shard, such as not in order.
Log upload related interfaces (PutLogs, WebTracks) share a call frequency and traffic limit amount, the specific limit is as follows:
- The total request frequency limit of the interface is 500 times/Shard/second. Exceeding the frequency limit will result in an ExceedQPSLimit error.
- The total traffic limit of the interface is 5MiB/Shard/s, and the traffic limit after log decompression in each shard is 30MiB/s. ExceedRateLimit will be reported if the traffic limit is exceeded. In large traffic scenarios, it is recommended to enable shard automatic splitting to avoid affecting data writing efficiency.
tip
- A LogGroupList cannot exceed 5MiB, the maximum size of the original log that can be written each time is 5MiB, each log in the log group cannot exceed 1MiB, and the number of logs in a LogGroup cannot exceed 10,000. The server level will check the length of the log data written to each PutLogs request. If the limit is exceeded, the entire request fails and no log data is successfully written.
- When configuring the key-value index of a field, if statistics is not enabled, word segmentation is not configured, and Chinese is not enabled, or statistics is not enabled, the field length cannot exceed 32KiB, otherwise the index creation fails.
- Request URL:https://{tls-endpoint}/PutLogs
The table below only lists the request parameters specific to this interface and some common parameters. For more information, please see Common parameters. LogGroup description
Log instructions:
Content description
LogTag:
There are no unique return parameters for this interface. For more information, please refer to the Response message. Content-Type: application/x-protobuf
<LogGroupList in PB format>
Content-Type: application/json; charset=utf-8
The following table lists the error codes related to the interface and business logic. For common error codes, please refer to Common error codes.
Last updated: 2025.10.29 14:35:21