All Products
Search
Document Center

Simple Log Service:Install the HarmonyOS SDK

Last Updated:Dec 03, 2026

Before you use the Simple Log Service SDK for HarmonyOS to send logs from HarmonyOS devices to Simple Log Service, activate Simple Log Service, obtain an AccessKey pair, and set up a HarmonyOS development environment.

Prerequisites

  • Simple Log Service is activated.

  • A project and a standard logstore are created. For instructions, see Manage projects and Create a standard logstore.

  • An AccessKey pair has been obtained. For more information, see AccessKey pair.

    Important

    An Alibaba Cloud account AccessKey pair grants full API access and poses a high security risk. We recommend that you use a RAM user for API access and routine O&M. Make sure the RAM user has the required permissions to manage Simple Log Service resources. For instructions, see Create a RAM user and grant permissions.

  • A HarmonyOS application development environment is set up. For more information, see HarmonyOS Developer Guide.

    The Simple Log Service SDK for HarmonyOS supports HarmonyOS API version 9.0 and later.

Basic information

Item

Description

SDK name

Simple Log Service (SLS) SDK for HarmonyOS

Developer

Alibaba Cloud Computing Co., Ltd.

SDK version

0.4.0

SDK package name

com.aliyun.sls.harmony

SDK update date

2026.11.02

SDK size

1.56 MiB

SDK MD5

c4a27224726274227dc226c66386911b

SDK download

@aliyunsls/producer

Install the SDK

  1. Create a HarmonyOS application project.

  2. Import the Simple Log Service SDK for HarmonyOS module. In the entry or library directory of your project, run the following command:

ohpm install @aliyunsls/producer

This command automatically adds the following dependency to the oh-package.json5 file in the entry or library directory:

"dependencies": {
 "@aliyunsls/producer": "^0.3.0"
}
  1. After you import the module, add the following import statement to the relevant .ets file:

import { AliyunLog, LogCallback } from "@aliyunsls/producer"

Compliance instructions

Important

You must inform your users that you use the Simple Log Service (SLS) SDK. Add the following reference clauses to your privacy policy.

  • SDK name: Simple Log Service (SLS) SDK

  • Purpose: Perform statistical analysis on app data.

  • Operator: Alibaba Cloud Computing Co., Ltd.

  • Types of personal information collected: Device information, network information, application information (application name and application version), and carrier information.

Next steps

To collect log data using the HarmonyOS SDK, see HarmonyOS SDK quick start.