POST /structuredlog?topic_id=xxxxxxxx-xxxx-xxxx-xxxx HTTP/1.1Host: <Region>.cls.tencentyun.comAuthorization: <AuthorizationString>Content-Type: application/x-protobuf<`LogGroupList` content packaged as a PB file>
${region}.cls.tencentyun.com, which is only valid for access requests from the same region, that is, CVM or Tencent Cloud services access the CLS service in the same region through the private domain name.${region}.cls.tencentcs.com. After the access source is connected to the internet, the public domain name of CLS can be accessed under normal circumstances.region field is the abbreviation for the CLS region. For example, for the Beijing region, enter ap-beijing. For the complete list of regions and their formats, refer to Region List.ap-beijing - Beijingap-shanghai - Shanghaiap-guangzhou - Guangzhouap-chengdu - Chengdu...
POST /structuredlog?topic_id=xxxxxxxx-xxxx-xxxx-xxxx HTTP/1.1Host: <Region>.cls.tencentyun.comAuthorization: <AuthorizationString>Content-Type: application/x-protobufx-cls-compress-type:lz4<`LogGroupList` content packaged as a PB file>
POST /structuredlog?topic_id=xxxxxxxx-xxxx-xxxx-xxxx HTTP/1.1Host: <Region>.cls.tencentyun.comAuthorization: <AuthorizationString>Content-Type: application/x-protobuf<`LogGroupList` content packaged as a PB file>
POST /structuredlog
Field Name | Type | Location | Required | Description |
topic_id | string | query | Yes | ID of the target log topic to which data will be uploaded, which can be viewed on the log topic page |
logGroupList | message | pb | Yes | The logGroup list, which describes the encapsulated log groups. No more than five |
Field Name | Required | Description |
logs | Yes | A Log array, which is a collection of multiple Logs. A Log represents a single Log entry. The number of Logs in a LogGroup must not exceed 10,000. |
contextFlow | No | UID used to maintain context, which does not take effect currently |
filename | No | Log filename |
source | No | Log source, which is generally the server IP |
logTags | No | Tag list of the log |
Field Name | Required | Description |
time | Yes | UNIX timestamp of log time in seconds or milliseconds (recommended) |
contents | No | Log content in key-value format. A log can contain multiple key-value pairs. |
Field Name | Required | Description |
key | Yes | Key of a field group in one log, which cannot start with _. |
value | Yes | Value of a field in a single log entry. Each value should not exceed 1 MB, and the total size of all values in a LogGroup should not exceed 5 MB. Note: The value must be assigned as a string type. If you want the value to be treated as other types, such as long or double, during log search and analysis, you can specify the value type when key-value indexing is configured for this field. For details, see Index Configuration. |
Field Name | Required | Description |
key | Yes | Key of a custom tag |
value | Yes | Value corresponding to the custom tag key |
HTTP/1.1 200 OKContent-Length: 0
wget https://main.qcloudimg.com/raw/d7810aaf8b3073fbbc9d4049c21532aa/protobuf-2.6.1.tar.gz
protobuf-2.6.1.tar.gz archive to the /usr/local directory, go to that directory, and run the following command:tar -zxvf protobuf-2.6.1.tar.gz -C /usr/local/ && cd /usr/local/protobuf-2.6.1
./configuremake && make installexport PATH=$PATH:/usr/local/protobuf-2.6.1/bin
protoc --version
.proto.package cls;message Log{message Content{required string key = 1; // Key of each field grouprequired string value = 2; // Value of each field group}required int64 time = 1; // Unix timestamprepeated Content contents = 2; // Multiple `key-value` pairs in one log}message LogTag{required string key = 1;required string value = 2;}message LogGroup{repeated Log logs = 1; // Log array consisting of multiple logsoptional string contextFlow = 2; // This parameter does not take effect currentlyoptional string filename = 3; // Log filenameoptional string source = 4; // Log source, generally using the server IP addressrepeated LogTag logTags = 5;}message LogGroupList{repeated LogGroup logGroupList = 1; // Log group list}
protoc --cpp_out=./ ./cls.proto
--cpp_out=./ : This option compiles the code into C++ format and outputs the files to the current directory../cls.proto: This refers to the cls.proto description file located in the current directory.
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback