All Products
Search
Document Center

Simple Log Service:Install the HarmonyOS SDK

Last Updated:Jun 17, 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. For more information, see .

  • 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.

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"

Next steps

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