Simple Log Service (SLS) provides SDKs in .NET Core, Java, Python, PHP, Node.js, C, Go, iOS, Android, and C++ for collecting, querying, and analyzing logs.
Before you begin
All SLS SDKs wrap the SLS API and provide similar features regardless of language:
-
Encapsulates API operations so you don't need to construct requests or parse responses manually. Operations are similar across languages, making it easy to switch between SDKs. API specifications.
-
Handles digital signature logic, eliminating manual signature management. Request signatures.
-
Encapsulates logs in Protocol Buffers (Protobuf) format, abstracting serialization details. Protobuf format.
-
Implements API-defined compression. Some SDKs write logs in compressed mode by default.
-
Provides unified error handling using language-native exception patterns. Error handling mechanism.
-
All current SDKs support only synchronous requests.
SDK list
The following table lists reference documents and GitHub repositories for each SDK.
SLS imposes limits on projects, Logstores, shards, and LogItem size. Review Limits on basic resources before using an SDK.
After collecting logs via an SDK, configure indexes to enable query, analysis, and transformation. Create an index. Quick guide to query and analysis.
|
SDK language |
Reference |
GitHub source code |
|
Java |
||
|
.NET Core |
||
|
PHP |
||
|
Python |
||
|
Node.js |
||
|
C |
||
|
GO |
||
|
iOS |
||
|
Android |
||
|
C++ |
||
|
HarmonyOS |
Call example
FAQ
What features do the Simple Log Service SDKs support?
The SLS SDKs support most SLS features, including log collection, index creation, query and analysis, data transformation, log consumption, log delivery management, alerting, and scheduled SQL jobs. If a feature is unsupported, upgrade to the latest SDK version or check for updates in subsequent releases.
What is the basic procedure for using a Simple Log Service SDK?
Using an SDK follows a similar workflow to using the console:
-
Activate Simple Log Service.
-
Obtain an AccessKey pair.
-
Create a project and a Logstore.
-
Collect logs and store them in the Logstore.
-
Create an index for the logs.
-
Query and analyze logs, and visualize the results.
-
Perform operations on log data, such as data transformation, delivery, and alerting.
For simpler operations, use the SLS console. Quick Start.
How do I handle common errors when I debug an SDK?
The SLS SDKs provide built-in error handling. Exceptions fall into the following categories:
Exceptions that are returned by Simple Log Service. This type of exceptions are handled by Simple Log Service SDK. For more information about this type of exceptions, see the description and error codes of each API operation. For more information about the error codes, see Error codes.
Network exceptions that occur when you use Simple Log Service SDK to send requests. This type of exceptions include network disconnection and server response timeout.
Exceptions that are generated by Simple Log Service SDK and related to platforms and programming languages, such as, memory overflow.
For solutions to common errors related to log collection, indexing, query and analysis, and transformation, see the FAQ.
Are there limits on using the Simple Log Service SDKs?
SLS imposes limits on projects, Logstores, shards, and LogItem size. Review Limits on basic resources before using an SDK.
Are there code example documents for using the SDKs?
SLS provides code examples for common operations. See the reference documents for each SDK.
-
Simple Log Service SDK for Java:
-
Simple Log Service SDK for Python:
-
Simple Log Service SDKs for various languages:
For more source code, see the Alibaba Cloud log repositories on GitHub.
References
Simple Log Service SDK debugging platform
The Alibaba Cloud OpenAPI Developer Portal provides debugging tools, SDKs, examples, and documentation. You can debug SLS API operations without manually constructing requests or handling signatures. OpenAPI Developer Portal.
Command-line interface (CLI)
SLS also provides a command-line interface (CLI) for automated configuration. Command-line interface (CLI).
Billing
Using the SDKs, OpenAPI Developer Portal, and CLI incurs the same fees as using the console. Billing overview.