All Products
Search
Document Center

Simple Log Service:Overview

Last Updated:Nov 10, 2025

Simple Log Service (SLS) SDK for Python encapsulates most API operations of SLS. You can use SLS SDK for Python to call most API operations of SLS.

Versions

For more information, see Alibaba Cloud Simple Log Service SDK for Python Releases.

Sample code

SLS SDK for Python provides a variety of sample code that you can use or reference. The following table describes the sample code that is provided by SLS SDK for Python.

GitHub source code

Description

sample.py

Includes sample code that shows how to write logs, query Logstores, obtain the distribution of logs, and manage machine groups.

sample2.py

Includes sample code that shows how to write logs, query logs by shard, and manage shards.

Sample3.py

Includes sample code that shows how to write logs, query logs by shard, manage shards, create an external data source, and query logs.

sample_consumer.py

Includes sample code that shows how to use a consumer group to consume logs.

test_alert.py

Includes sample code that shows how to manage alerts.

sync_data_to_splunk.py

Includes sample code that shows how to use a consumer group to synchronize data to Splunk.

sync_data_to_syslog.py

Includes sample code that shows how to use a consumer group to synchronize data to a syslog server.

test_migration_manager.py

Includes sample code that shows how to create a migration configuration file and migrate data.

CreateETL

Includes sample code that shows how to create, modify, and delete a data transformation task.

CreateOSSExport

Includes sample code that shows how to ship logs to Object Storage Service (OSS) and MaxCompute.