SuperAPI AI 工具集

alibabacloud-sls-cli-guidance

部署与运维

查看项目

更新于 10-15 16:48

技能介绍

用途:通过 aliyun-cli 管理阿里云日志服务(SLS)资源,包括项目、Logstore、Logtail 配置、机器组等非查询操作。日志查询与分析需改用 alibabacloud-sls-query 技能。

主要能力:管理 SLS 项目(list/create/get/update/delete-project);管理 Logstore(list/create/get/update/delete-log-store);配置索引以启用查询与 SQL 分析(get/create/update/delete-index);写入日志(put-json-logs);管理 Logtail 采集配置(create/update/get/list/delete-logtail-pipeline-config,支持文件输入、JSON/分隔符/正则解析、多行、时间提取);管理机器组并应用配置(create/update/get/list/delete-machine-group、apply-config-to-machine-group、remove-config-from-machine-group、get-applied-configs)。

使用方式:先确认已安装 aliyun-cli 与 sls 插件,运行 aliyun version、aliyun sls version;未安装时按 references/cli-installation-guide.md 安装,并执行 aliyun plugin install --names sls,更新用 aliyun plugin update sls。用 aliyun configure list 检查凭证,若无有效 profile 则停止并请用户在会话外运行 aliyun configure。调用云 API 的命令需带 --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-sls-cli-guidance/{session-id}",本地命令(version、configure、plugin、help)不加。可用 aliyun help sls、aliyun help sls <apiName> 发现 API,--cli-dry-run 校验参数,--cli-query 以 JMESPath 过滤输出,--region 覆盖地域。

限制与规则:禁止读取、回显或打印 AK/SK,禁止要求用户粘贴 AK/SK。删除操作不可逆,须先获用户明确批准,破坏性操作先用 --cli-dry-run。更新 API 需完整参数,先调用对应 Get API 获取当前参数再提交。不要使用已废弃的 get-logs,改用 get-logs-v2。命令失败时参考 references/troubleshooting.md。