alibabacloud-sls-index-config-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Alibaba Cloud SLS Index Configuration Manager

阿里云SLS索引配置管理器

Scenario Description

场景描述

Use this skill for SLS Logstore index configuration.
This file only covers trigger-time setup, routing, and cross-scenario safety. Read only the reference document needed for the user's request.

本Skill用于SLS Logstore索引配置。
本文档仅涵盖触发时的设置、路由以及跨场景安全相关内容。仅阅读用户请求所需的参考文档即可。

Prerequisites

前置条件

Install Aliyun CLI

安装Aliyun CLI

Run
aliyun version
to verify the version is
>= 3.3.8
. If not installed or outdated, follow references/cli-installation-guide.md to install or update.
运行
aliyun version
验证版本是否
>= 3.3.8
。若未安装或版本过时,请按照references/cli-installation-guide.md进行安装或更新。

Ensure AI Mode Enabled

确保AI模式已启用

Before executing any SLS API commands, enable AI-Mode, set User-Agent, and update plugins:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-sls-index-config-management"
aliyun plugin update
执行任何SLS API命令前,需启用AI模式、设置User-Agent并更新插件:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-sls-index-config-management"
aliyun plugin update

Check Alibaba Cloud credentials configured

检查阿里云凭证配置

Run
aliyun configure list
to check if credentials are configured. If no valid profile is shown, STOP here and ask the user to run
aliyun configure
outside of this session.
Security rules:
  • NEVER read, echo, or print AK/SK values
  • NEVER ask the user to paste AK/SK into the conversation
  • ONLY use
    aliyun configure list
    to check credential status

运行
aliyun configure list
检查凭证是否已配置。若未显示有效配置文件,请立即停止并告知用户在本次会话外运行
aliyun configure
安全规则:
  • 绝对禁止读取、回显或打印AK/SK值
  • 绝对禁止要求用户将AK/SK粘贴到对话中
  • 仅可使用
    aliyun configure list
    检查凭证状态

RAM Permission Requirements

RAM权限要求

On
Unauthorized
error, surface references/ram-policies.md to the user. Do not retry with a different account without explicit confirmation.

若出现
Unauthorized
错误,请向用户提供references/ram-policies.md。未经明确确认,请勿使用其他账号重试。

Routing the Request

请求路由

After environment and credential checks, classify the user's request and follow the matching reference:
If the user wants to …Go to
View / create / update / delete an index, or change a single field, TTL,
max_text_len
, full-text on-off, log_reduce, etc.
references/manage-index-config.md
Build an index for a Logstore that has none, or rebuild from scratch using user-provided structured log samplesreferences/generate-index-from-logs.md
Adjust an existing index to support a new query / SQL, reduce cost, or improve write throughputreferences/optimize-index-config.md
Mixed requests are common (e.g. "generate an index for these logs and then update it on Logstore X"). Read the relevant scenario docs in order.

完成环境和凭证检查后,对用户请求进行分类并遵循对应的参考文档:
用户需求跳转至
查看/创建/更新/删除索引,或修改单个字段、TTL、
max_text_len
、全文索引开关、log_reduce等
references/manage-index-config.md
为无索引的Logstore创建索引,或根据用户提供的结构化日志样本重新构建索引references/generate-index-from-logs.md
调整现有索引以支持新的查询/SQL、降低成本或提升写入吞吐量references/optimize-index-config.md
混合请求较为常见(例如:"为这些日志生成索引并更新到Logstore X")。请按顺序阅读相关场景文档。

Global Rules

全局规则

  • No writes without the scenario reference. Before any write operation, read the relevant reference document and follow its confirmation, full-body, rollback, and timing rules.
  • Use exact SLS CLI names. Product is
    sls
    ; subcommands and flags are kebab-case. Use references/acceptance-criteria.md only when validating command shape or debugging CLI invocation issues.
  • 无场景参考则禁止写入操作。执行任何写入操作前,需阅读相关参考文档并遵循其确认、全量操作、回滚和时序规则。
  • 使用准确的SLS CLI名称。产品名为
    sls
    ;子命令和参数采用短横线命名法(kebab-case)。仅在验证命令格式或调试CLI调用问题时使用references/acceptance-criteria.md

Output Format

输出格式

Every time you present an index configuration to the user — whether from a read (
get-index
), after a write (
create-index
/
update-index
), or during generation/optimization — output both:
  1. Complete JSON — the full
    get-index
    JSON response (or the equivalent JSON body you are about to submit for a write). Wrap it in a fenced
    json
    code block so the user can copy-paste it directly.
  2. Human-readable summary
Put the Complete JSON first, then the summary. The summary helps the user understand the config at a glance; the JSON is the authoritative, machine-readable reference they can use for scripting, version control, or future
update-index
calls.

每次向用户展示索引配置时——无论是读取操作(
get-index
)的结果、写入操作(
create-index
/
update-index
)后的结果,还是生成/优化过程中的配置——都需同时输出以下两项:
  1. 完整JSON——完整的
    get-index
    JSON响应(或即将提交的写入操作对应的JSON主体)。将其包裹在带围栏的
    json
    代码块中,方便用户直接复制粘贴。
  2. 易读摘要
先展示完整JSON,再展示摘要。摘要帮助用户快速理解配置内容;JSON则是权威的机器可读参考,可用于脚本编写、版本控制或后续的
update-index
调用。

Cleanup

清理操作

Whether operations succeed or fail, you MUST disable AI-Mode before ending the session:
bash
aliyun configure ai-mode disable

无论操作成功与否,会话结束前必须禁用AI模式:
bash
aliyun configure ai-mode disable

Reference Documents

参考文档

DocumentDescription
references/manage-index-config.mdIndex config format and get / create / update / delete command examples
references/generate-index-from-logs.mdInfer a complete index configuration from user-provided structured log samples
references/optimize-index-config.mdOptimize an existing index for query/SQL workload, cost, and write throughput
references/related-apis.md
GetIndex
/
CreateIndex
/
UpdateIndex
/
DeleteIndex
API & CLI reference
related_apis.yamlMachine-readable dependent API metadata for this skill
references/ram-policies.mdMinimum and complete RAM policies for index management
references/acceptance-criteria.mdCLI invocation acceptance tests
references/cli-installation-guide.mdAliyun CLI install, auth modes, profiles
文档描述
references/manage-index-config.md索引配置格式及查看/创建/更新/删除命令示例
references/generate-index-from-logs.md根据用户提供的结构化日志样本推导完整的索引配置
references/optimize-index-config.md针对查询/SQL工作负载、成本和写入吞吐量优化现有索引
references/related-apis.md
GetIndex
/
CreateIndex
/
UpdateIndex
/
DeleteIndex
API及CLI参考文档
related_apis.yaml本Skill的机器可读依赖API元数据
references/ram-policies.md索引管理所需的最小及完整RAM策略
references/acceptance-criteria.mdCLI调用验收测试
references/cli-installation-guide.mdAliyun CLI安装、认证模式及配置文件说明