Log Service provides an SDK for different programming languages, such as .NET, Java, Python, PHP, and C. You can select Log Service SDK for a specific programming language based on your business requirements. The SDK allows you to perform various operations, such as collecting, querying, and analyzing logs.

Usage notes

Log Service SDK for different programming languages varies in terms of implementation. However, Log Service SDK for different programming languages encapsulates the same operations of Log Service API and provides similar features. Log Service SDK supports the following features:

  • Encapsulation of Log Service API. Log Service SDK implements the underlying API request creation and response parsing. Log Service API for different programming languages supports similar operations. This simplifies the switchover between different programming languages. For more information, see API regulations.
  • Automatic digital signature of API requests. You do not need to specify the digital signature logic of Log Service API. This simplifies the use of Log Service API. For more information, see Request signatures.
  • Protocol Buffer-formatted encapsulation of logs. The logs that are collected by Log Service are encapsulated in the Protocol Buffer format. You do not need to specify a format. For more information, see Protocol Buffer format.
  • Log compression by using the method that is defined in Log Service API. Log Service SDK for several programming languages allows you to specify whether logs can be written to Log Service in compression mode. By default, the compression mode is used.
  • Unified exception handling mechanism. You can use Log Service SDK to handle exceptions based on the programming language. For more information, see Exception handling.
  • Support only for synchronous requests.

Log Service SDK for different programming languages

The following table provides links to the references and GitHub source code of Log Service SDK for different programming languages.
Note Log Service imposes limits on basic resources, such as the number of projects, the number of Logstores, the number of shards, and the size of LogItem. We recommend that you read the topic about the limits before you use Log Service SDK. For more information, see Limits on basic resources.

After you collect logs to Log Service by using Log Service SDK, you must configure indexes for the logs. Then, you can perform various operations such as query, analysis, and transformation on the logs. For more information, see Create indexes and Query and analyze logs.

Programming languageReferencesGitHub source code
JavaOverview of Log Service SDK for JavaLog Service SDK for Java, Log Service SDK for Java 0.6.0 API, and Producer Library
.NET CoreOverview of Log Service SDK for .NET CoreLog Service SDK for .NET Core
.NETOverview of Log Service SDK for .NETLog Service SDK for .NET
PHPOverview of Log Service SDK for PHPLog Service SDK for PHP
PythonOverviewLog Service SDK for Python and User guide
Node.jsOverview of Log Service SDK for Node.jsLog Service SDK for Node.js
CLog Service SDK for CLog Service SDK for C and C Producer Library
GoOverviewLog Service SDK for Go
iOSOverview of Log Service SDK for iOSLog Service SDK for iOS and Log Service SDK for Objective-C
AndroidOverview of Log Service SDK for AndroidLog Service SDK for Android
C++Overview of Log Service SDK for C++Log Service SDK for C++
JavaScriptNone

FAQ

What features does Log Service SDK support?

Log Service SDK supports most features of Log Service. For example, you can use Log Service SDK to collect, index, query, analyze, transform, consume, and ship logs. You can also configure alerts for logs and manage Scheduled SQL jobs. If you identify a feature that is not supported when you use Log Service SDK, we recommend that you update Log Service SDK to the latest version and try again or pay attention to subsequent SDK version updates.

How do I use Log Service SDK?

Log Service SDK provides end-to-end log management. You can use Log Service SDK in the similar manner as you perform operations in the Log Service console. You can perform the following steps to use Log Service SDK:
  1. Activate Log Service.
  2. Obtain an AccessKey pair.
  3. Create a project and a Logstore.
  4. Collect logs and store the logs to the Logstore.
  5. Create indexes for the logs.
  6. Query and analyze the logs and visualize the query and analysis results.
  7. Transform and ship the logs, and configure alerts for the logs.
Log Service provides a console in which you can perform operations in an efficient manner. For more information, see Getting Started.

How do I handle common errors that may occur when I use Log Service SDK?

Log Service SDK provides error handing logic. The following errors may occur when you use Log Service SDK.
  • Errors returned by the Log Service. This type of errors is returned by the Log Service and handled by SDKs. For more information about this error type, see the Error codes of the Log Service APIs and the descriptions of each API.
  • Network errors that occur when SDKs send requests to the Log Service. This type of errors includes network interruptions and Log Service return timeout.
  • Errors that are produced by SDKs and related to platforms or languages, for example, memory overflow.
For more information, see Exception handling.

When you use Log Service SDK to perform operations such as log collection, index management, data query and analysis, and data transformation, errors may occur. You can handle the errors based on the Log Service FAQ. For more information, see FAQ.

Are limits imposed when I use Log Service SDK?

Yes, Log Service imposes limits on basic resources such as the number of projects, the number of Logstores, the number of shards, and the size of LogItem. We recommend that you read the topic about the limits before you use Log Service SDK. For more information, see Limits on basic resources.

After you collect logs to Log Service by using Log Service SDK, you must configure indexes for the logs. Then, you can perform various operations such as query, analysis, and transformation on the logs. For more information, see Create indexes and Query and analyze logs.

Are open debugging platforms available for Log Service SDK?

Yes, Alibaba Cloud provides OpenAPI Explorer for you to debug Log Service SDK. The platform also provides other SDKs, examples, and related documents. If you use OpenAPI Explorer, you can debug Log Service API operations without the need to manually encapsulate requests or sign the requests. For more information, visit OpenAPI Explorer.

Are documents that provide sample code of Log Service SDK available?

Yes, Log Service provides documents for you to obtain sample code of commonly used operations. For more information, see related SDK documents. For more information about source code, visit Alibaba Cloud GitHub.