Install SLS Skill
SLS Skill
alibabacloud-sls is an Agent Skill provided by Alibaba Cloud Simple Log Service (SLS). It helps you manage the full log lifecycle and covers all core SLS capabilities:
Capability |
Use cases |
Log query and analysis |
Generate SQL, SPL, and other query statements from natural language to query and analyze logs in real time, for example, calculate error rates, analyze trends, and locate anomalous requests. |
Collection configuration |
Install or upgrade Logtail/LoongCollector, manage collection configurations and machine groups, and troubleshoot heartbeat anomalies or missing log uploads. |
Index configuration |
Create or adjust full-text and field indexes, and automatically generate and optimize index configurations based on log samples. |
Alert management |
Configure alert rules and notification methods, and troubleshoot why alerts did or did not trigger. |
SDK integration |
Choose API SDKs, log writing SDKs, and consumer group SDKs based on language and scenario; integrate log writing, consumption, or querying; and automatically generate SDK call code. |
Data processing |
Manage data processing jobs, generate SPL processing statements, and diagnose their runtime status. Use these capabilities for field extraction, data masking, data replication, and other data processing scenarios. |
Scheduled SQL |
Manage Scheduled SQL jobs and diagnose their runtime status. |
Dashboards and visualization |
Turn query results into visual dashboards with trend charts, metric cards, or tables, and manage dashboard subscriptions. |
Business semantics |
Use available semantic models to locate data sources and verify field meanings, business terminology, and metric definitions. |
Service diagnostics |
Use built-in SLS service logs, access logs, and alert execution history to troubleshoot collection, consumption, data processing, or Scheduled SQL issues. |
After installation, you can use natural language in your agent to query and analyze logs, configure LoongCollector collection and log indexes, manage alerts and dashboards, and get SLS SDK integration examples.
For details about the skill, visit the Cloud Skills portal: alibabacloud-sls.
Prerequisites
-
Prepare a client that supports Agent Skills, such as Claude Code, Codex, Qoder, Qwen Code, or OpenClaw. To perform cloud operations, the client must also be able to run local commands.
Install the skill
Method 1 (recommended): Install with npx
To install with npx, you must install Node.js and have access to the npm registry and GitHub.
-
In a terminal, check that Node.js and
npxare available.node -v npx -v -
Run the following command in a terminal. The
-goption installs the skill in a user-level directory so that you can use it across multiple projects in the selected client.npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-sls --full-depth -g -
Select the target agent when prompted. After installation, reload the skill or restart the agent client.
Method 2: Ask your agent to install the skill
Send the following prompt to your agent so that it can install the skill using the tools available in its environment.
Download and install the alibabacloud-sls Skill from https://skills.aliyun.com/api/public/skills/alibabacloud-sls/download. After installation, tell me whether I need to restart the conversation.
Method 3: Download and install manually
-
Download the alibabacloud-sls package from the Cloud Skills portal.
-
Create an
alibabacloud-slssubdirectory in the target agent's skills directory. The following table lists the directories for common clients.~represents the current user's home directory.Agent client
Project-level directory
User-level directory
Claude Code
.claude/skills/~/.claude/skills/Codex
.agents/skills/~/.agents/skills/Qoder
.qoder/skills/~/.qoder/skills/Qwen Code
.qwen/skills/~/.qwen/skills/OpenClaw
skills/in the current agent workspace~/.openclaw/skills/ -
Extract the package into the
alibabacloud-slsdirectory. Make sure thatSKILL.md,references/, andscripts/are at the same level.<Skills directory>/ └── alibabacloud-sls/ ├── SKILL.md ├── references/ └── scripts/ -
Reload the skill or restart the agent client. For a project-level installation, open a new conversation in the corresponding project.
Install and configure Alibaba Cloud CLI and the SLS plugin
Some capabilities of alibabacloud-sls, such as querying logs and managing Logstores, use Alibaba Cloud CLI and the SLS plugin.
|
Component |
Minimum version |
|
Alibaba Cloud CLI |
3.3.22 |
|
SLS plugin |
0.10.0 |
When you first use SLS Skill, the agent automatically guides you through installing and configuring Alibaba Cloud CLI and the SLS plugin. We recommend following the agent's prompts to complete the configuration.
You can also install and configure these components manually, as described below.
Manual installation and configuration
-
Install or update Alibaba Cloud CLI. On Linux and macOS, run the following command to install the CLI. If you installed the CLI using this script, run the same command again to update it. For Windows and other installation methods, see Install, update, and uninstall Alibaba Cloud CLI. Installation may require administrator privileges.
sudo /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" -
Install or update the SLS plugin. Use the
installcommand to install the plugin, or theupdatecommand to upgrade an installed plugin.# Install the SLS plugin aliyun plugin install --name sls # Update the SLS plugin aliyun plugin update --name sls -
Configure credentials
Alibaba Cloud CLI supports multiple credential types, such as AccessKey (AK), OAuth, STS tokens, and RAM roles (for example, EcsRamRole and RamRoleArn). You can save separate profiles for different accounts or environments. Make sure that the identity you use has the permissions required to access the target SLS resources. The following sections describe AccessKey and OAuth configuration. For other credential types, see Configure and manage credentials.
Use AccessKey credentials
If you have an AccessKey pair, you can configure AccessKey credentials.
Run the following command in a local terminal. Enter your AccessKey ID, AccessKey Secret, and default region when prompted. The CLI saves the configuration as the default credential profile. Use
--profile <profileName>to specify a custom profile name.aliyun configureDo not paste AccessKey credentials or STS tokens into an agent conversation. Doing so may expose your credentials.
Use OAuth credentials
OAuth credentials let you sign in and authorize access in a browser. You grant the CLI access using the Alibaba Cloud account signed in to the browser, and the CLI uses that identity to access cloud resources.
Run the following command in a local terminal, enter the default region when prompted, and complete Alibaba Cloud sign-in and authorization in the browser. For detailed configuration steps, see OAuth credentials.
aliyun configure --mode OAuth-
If credentials are already configured, run
aliyun configure listto view the available profiles. -
Run
aliyun configure switch --profile <profileName>to switch the default credential profile. -
When running a CLI command, use
--profile <profileName>to specify the credential profile for that command.
-
FAQ
Do I need to install Alibaba Cloud CLI and the SLS plugin manually?
Usually, no. When you request a log query in the agent, it automatically checks the environment (aliyun version), enables AI Mode, sets the User-Agent, and updates the plugin.
If Alibaba Cloud CLI is not installed locally or its version is too old, the agent provides installation or upgrade instructions. Run the commands provided by the agent in your local environment to complete the installation.
How do I configure Alibaba Cloud account credentials?
Follow the agent's prompts, or manually run aliyun configure. Supported credential types include AK, StsToken, OAuth, and RamRole. For details, see Configure and manage credentials.
How do I use specific Alibaba Cloud account credentials or a region?
The skill uses the current default Alibaba Cloud CLI profile. To use a specific profile, explicitly include its name in your prompt. For example: Use Profile=prod to manage alert rules for prod-web in cn-hangzhou.
Run aliyun configure list to view all profiles, or aliyun configure switch --profile <profileName> to switch the default credential profile.
Are internal, transfer acceleration, and custom endpoints supported?
Yes. In your prompt, ask the agent to specify an endpoint using --endpoint <domain>.
Alternatively, use aliyun configure set with --endpoint <domain> to set a fixed endpoint for a profile. A fixed endpoint may prevent commands for products other than SLS from accessing their services when using that profile.
The agent does not recognize the skill after installation
-
Check whether the skill is installed at either the project level or the user level, typically in
.agents/skills/or~/.agents/skills/. -
If the skill is installed, the agent may not support dynamic skill loading. Restart the agent.
The agent cannot find aliyun or the SLS plugin
-
Run
ls -l /usr/local/bin/aliyunto check whether aliyun is installed. -
Run
which aliyunand check the PATH environment variable to make sure that Alibaba Cloud CLI is on the executable search path.
The agent cannot find configured credentials
-
Run
aliyun configure listto check whether credentials are configured correctly. -
Make sure that the agent process runs as the same user who configured the credentials, or check whether its credential file
$HOME/.aliyun/config.jsonexists.
Unauthorized or AccessDenied error
Check the identity selected by the CLI profile and whether it has the permissions required for the operation. You can run aliyun configure get to view the credentials. This command prints credentials directly. Do not share or expose its output.
ProjectNotExist error
Check the project name, owning account, and actual region. If an endpoint is specified, make sure that it matches the target region and network environment. Use --region <region> or --endpoint <domain> to specify the region and endpoint.
How do I migrate from older SLS skills to alibabacloud-sls?
Install alibabacloud-sls first. After installation, send the following prompt to the agent to remove the older skills:
Remove the older SLS skills that have been replaced by alibabacloud-sls, and upgrade the aliyun sls plugin to the latest version.