- Documentation
Torch Log Service
SDK reference
C++ SDK
Getting started
Getting started
This topic describes how to use Torch Log Service (TLS) SDK for C++ to quickly collect logs, including creating projects, creating topics, and writing logs.
Before you begin
Before you use TLS SDK for C++:
- Create and get a Volcano Engine AccessKey pair. The AccessKey pair has the permissions to access all API actions. We recommend that you use an IAM user to call API actions or perform routine O&M. Before you use an IAM user, use a Volcano Engine account to grant the IAM user the permissions to operate TLS resources.
Creating related resources
- Initialize a client instance.
- Refer to the following sample code to load TLS SDK for C++ and create a TLS client. When you initialize the client, we recommend that you use environment variables to dynamically get identity authentication information such as Volcano Engine AccessKey. Otherwise, hard-coded AccessKey information leads to data security risks.
- Use the TLS client to manage projects, such as creating and deleting projects. For information on how to set the parameters, refer to API overview.
- The following response is returned:
- Use the TLS client to manage topics, such as creating and deleting topics. For information on how to set the parameters, refer to API overview.
- The following response is returned:
Using the TLS client to upload logs
Use the TLS client to upload logs to a specific topic. The sample code is as follows. For information on how to set the parameters, refer to API overview. After you upload logs, view the log data collected to the server in the console. Alternatively, call SearchLogs to query the log data you uploaded. Using PutLogs V2 to upload logs
Defining Protobuf to upload logs is troublesome. If high performance is not required for uploading logs, consider using PutLogs V2 in TLS SDK for C++. It allows you to use the built-in data structure of the language to upload logs without building a complex log structure. Sample code:
Last updated: 2025.10.11 16:44:07