You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Python SDK
Python SDK overview
Copy page
Download PDF
Python SDK overview
The TLS Python SDK encapsulates commonly used interfaces of TLS. You can use the TLS Python SDK to call server-side APIs to implement log collection, log query, and other features.​
Notice​
Python SDK provides sample codes for Producer and Consumer to enable flexible log sending and consumption.​
Producer: Sample code for sending log data in Producer mode. For usage details, see example_producer.py.​
Consumer: Sample code for consuming log data via the Consumer consumer group. For usage details, see example_consumer.py.​
Version information​
For the TLS Python SDK release notes and version information, see GitHub. It is recommended to use the latest version of the SDK to experience enhanced product capabilities and more stable services.​
Example projects​
The TLS Python SDK provides a variety of example projects for your reference, including common scenarios such as log collection and resource management. For more information, refer to the GitHub source code.​
​
GitHub source code​
Description​
Example code for project management, including creating, modifying, viewing, and deleting projects.​
Example code for log topic management, including creating, modifying, viewing, and deleting log topics.​
Example code for log index management, including creating, modifying, querying, and deleting index configurations.​
Example code for log management, including uploading logs, querying consumer cursors, consuming logs, and querying and retrieving logs.​
Example code for host group management, including creating, modifying, querying host groups, querying hosts, querying host group collection configurations, deleting hosts, and deleting host groups.​
Example code for collection configuration management, including creating, modifying, querying, and deleting collection configurations, applying collection configurations to host groups, and deleting collection configurations from host groups.​
Example code for alarm management, including creating, modifying, querying, and deleting alarm groups, as well as creating, modifying, querying, and deleting alarm policies.​
Sample code for consuming log data using the Consumer consumer group. Consumer supports load-balanced consumption of data from all shards under a log topic, and features asynchronous consumption, high performance, failure retry, and graceful shutdown. TLS recommends using Consumer to consume logs.​
Sample code for data import, including creating TOS/Kafka import tasks, modifying TOS/Kafka import tasks, querying import tasks, and deleting import tasks.​
Sample code for log shipping, including creating TOS/Kafka shipping requests, validating and querying TOS/Kafka shipping configurations, modifying shipping configurations, querying the list of shipping configurations, filtering and querying configurations by type, and deleting shipping configurations.​
Sample code for sending logs using Producer mode.​
Sample code for TLS account management, including obtaining account status and enabling and activating TLS.​
​
​
Last updated: 2026.09.04 15:50:13