huaweicloud/huaweicloud-skills

huawei-cloud-lts-log-inspector

Huawei Cloud LTS (Log Tank Service) log traffic statistics, log context query, host group and access config inspection, collection status patrol, and OBS transfer management for batch log export.

查看源码
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

Huawei Cloud LTS Log Traffic and Collection Inspector

Overview

This Skill provides a comprehensive toolkit for Huawei Cloud LTS (Log Tank Service) log traffic analysis, collection health inspection, and batch log export management. It is designed for four primary scenarios:

  1. Log traffic anomaly troubleshooting - When log traffic surges, use TOP-N statistics

to identify which log stream is flooding.

  1. Fault deep-dive positioning - Given an abnormal log ID, automatically pull before/after

context log stacks to reconstruct the fault scene.

  1. Collection fault patrol - Check host group collection reporting status to locate

collection breakage.

  1. Batch log export - Create OBS transfer tasks to export large volumes of historical

logs to an OBS bucket for download.

Architecture

User Trigger -> Skill Workflow -> hcloud CLI LTS Commands -> Structured Output
                                    |-- Traffic Stats (Histogram / TOP-N / Timeline)
                                    |-- Log Context Query
                                    |-- Collection Inspection (HostGroup / Host / AccessConfig)
                                    |-- OBS Transfer (Create / List / Delete)
                                    +-- Diagnostic Report (Aggregated)

Important Limitations

FeatureStatusExplanation
Consumer group query (F8)UnavailableLTS consumer group is in invitation-only beta; only Java/Go SDK, no REST API or CLI
Consumer group cursor update (F11)UnavailableSame as above
Offline download task (F9/F10/F12)AlternativeLTS console offline download is whitelist-only with no public API. OBS transfer (CreateTransfer) is used as the alternative.

Constraints

  • Creating an OBS transfer task must output a traffic and storage cost risk warning before execution.
  • Bulk export of all logs is prohibited - always specify a log group and stream scope.
  • This Skill does not modify log group/stream TTL, index configurations, or alarm rules.
  • This Skill does not create or delete log groups or log streams.
  • Context log queries return concise fragments (default 100 lines before/after, max 500)

to avoid oversized text output.

Prerequisites

  1. hcloud CLI installed and authenticated with a valid AK/SK profile.
  • Installation guide: see references/cli-installation-guide.md
  • Verify: hcloud configure list shows a valid profile
  1. IAM permissions: LTS read permissions for query operations; LTS transfer write

permissions for OBS transfer create/delete. See references/iam-policies.md.

  1. Region: LTS must be available in the target region (e.g., cn-north-4).
  2. OBS bucket (for transfer only): A pre-existing OBS bucket is required when creating

an OBS transfer task.

Workflow

Scenario 1: Log Traffic Anomaly Troubleshooting

1. ListTopnTrafficStatistics -> Identify TOP-N log streams by write traffic (descending)
2. ListTimeLineTrafficStatistics -> Check traffic trend over the time window
3. ListLogHistogram -> Drill down into the suspect log stream histogram
4. Output: Structured traffic anomaly report

Scenario 2: Fault Deep-Dive Positioning

1. ListLogs -> Search for the target log by keyword/time range to get line_num
2. ListLogContext -> Pull context logs (before/after) using line_num
3. Output: Concise context log fragments (max 500 lines each direction)

Scenario 3: Collection Fault Patrol

1. ListHostGroup -> List all host groups
2. ListHost --filter.host_status=offline -> Find offline hosts
3. ListHost --filter.host_status=error -> Find error-state hosts
4. ListAccessConfig -> Check collection configs for affected hosts
5. Output: Collection anomaly checklist

Scenario 4: Batch Log Export (via OBS Transfer)

1. [Cost risk warning displayed to user]
2. User confirms
3. CreateTransfer -> Create OBS transfer task (log group + stream -> OBS bucket)
4. ListTransfers -> Monitor transfer status
5. User downloads logs from OBS bucket
6. (Optional) DeleteTransfer -> Clean up transfer after download

Core Commands

1. Log Traffic Statistics

1.1 Query Log Histogram

bash
hcloud LTS ListLogHistogram --cli-region={region} \
  --group_id={log_group_id} \
  --stream_id={log_stream_id} \
  --start_time={start_time} \
  --end_time={end_time} \
  --key_word={keyword} \
  --step_interval={step_interval}
ParameterRequiredDescription
--group_idYesLog group ID
--stream_idYesLog stream ID
--start_timeYesStart time
--end_timeYesEnd time
--key_wordYesSearch keyword
--step_intervalYesStep interval (integer)

1.2 Query TOP-N Traffic Statistics

bash
hcloud LTS ListTopnTrafficStatistics --cli-region={region} \
  --resource_type=log_stream \
  --topn=10 \
  --start_time={start_timestamp_ms} \
  --end_time={end_timestamp_ms} \
  --search_list.1=write \
  --sort_by=write \
  --is_desc=true \
  --filter.log_group_id={log_group_id}
ParameterRequiredDescription
--resource_typeYeslog_group, log_stream, or tenant
--topnYesTop N, range 1-100
--start_timeYesStart timestamp (ms), max 30-day range
--end_timeYesEnd timestamp (ms)
--search_list.1YesData type: index/write/storage/basicTransfer/seniorTransfer/coldStorage
--sort_byYesSort field, must be in search_list
--is_descYesDescending order: true/false
--filter.{key}YesFilter conditions (map), e.g., --filter.log_group_id=xxx

1.3 Query Timeline Traffic Statistics

bash
hcloud LTS ListTimeLineTrafficStatistics --cli-region={region} \
  --resource_type=log_stream \
  --search_type=write \
  --start_time={start_timestamp_ms} \
  --end_time={end_timestamp_ms} \
  --period=1 \
  --timezone=Asia/Shanghai \
  --resource_id={resource_id}
ParameterRequiredDescription
--resource_typeYeslog_group, log_stream, or tenant
--search_typeYeswrite/index/storage/basicTransfer/seniorTransfer
--start_timeYesStart timestamp (ms), max 30-day range
--end_timeYesEnd timestamp (ms)
--periodYesTime interval in hours, range 1-24
--timezoneYesTimezone string
--resource_idNoSpecific resource ID for filtering

2. Log Context Query

2.1 Query Log Content

bash
hcloud LTS ListLogs --cli-region={region} \
  --log_group_id={log_group_id} \
  --log_stream_id={log_stream_id} \
  --start_time={start_time_ms} \
  --end_time={end_time_ms} \
  --keywords={keyword} \
  --limit=100 \
  --is_desc=true

2.2 Query Log Context (Before/After)

bash
hcloud LTS ListLogContext --cli-region={region} \
  --log_group_id={log_group_id} \
  --log_stream_id={log_stream_id} \
  --line_num={line_num} \
  --backwards_size=100 \
  --forwards_size=100
ParameterRequiredDescription
--log_group_idYesLog group ID
--log_stream_idYesLog stream ID
--line_numNoLog line sequence number (nanosecond timestamp), from ListLogs result
--backwards_sizeNoLines before (context above), range [0, 500], default 100
--forwards_sizeNoLines after (context below), range [0, 500], default 100
--scroll_idNoPagination scroll ID from previous query
Note: To get line_num, first call ListLogs to search for the target log, then use the returned line_num value in ListLogContext.

3. Collection Inspection

3.1 List Host Groups

bash
hcloud LTS ListHostGroup --cli-region={region} \
  --filter.host_group_type=linux
ParameterRequiredDescription
--filter.host_group_typeNowindows or linux
--filter.host_group_name_list.1NoHost group name filter
--host_group_id_list.1NoHost group ID filter

3.2 List Hosts (Collection Status)

bash
hcloud LTS ListHost --cli-region={region} \
  --filter.host_status=offline
ParameterRequiredDescription
--filter.host_statusNoHost status: uninstall, running, offline, error, plugin error, installing, install-fail, upgrading, upgrade-fail, uninstalling, authentication error
--filter.host_name_list.1NoHost name filter
--filter.host_ip_list.1NoHost IP filter
--host_id_list.1NoHost ID filter
Collection status meanings: - running - Agent running normally, logs being collected - offline - Host offline, collection broken - error / plugin error - Agent error, collection may be broken - uninstall - Agent not installed - authentication error - Auth failure, collection broken

3.3 List Access Configs (Collection Configs)

bash
hcloud LTS ListAccessConfig --cli-region={region} \
  --access_config_name_list.1={config_name}
ParameterRequiredDescription
--access_config_name_list.1NoAccess config name filter
--host_group_name_list.1NoHost group name filter
--log_group_name_list.1NoLog group name filter
--log_stream_name_list.1NoLog stream name filter

4. OBS Transfer (Batch Log Export Alternative)

Cost Risk Warning: Creating an OBS transfer task will incur OBS storage costs and LTS transfer fees based on the actual log transfer volume. Always confirm with the user before creating a transfer task.

4.1 Create OBS Transfer

bash
hcloud LTS CreateTransfer --cli-region={region} \
  --log_group_id={log_group_id} \
  --log_streams.1.log_stream_id={log_stream_id} \
  --log_transfer_info.log_transfer_type=OBS \
  --log_transfer_info.log_transfer_mode=cycle \
  --log_transfer_info.log_transfer_status=ENABLE \
  --log_transfer_info.log_storage_format=RAW \
  --log_transfer_info.log_transfer_detail.obs_bucket_name={obs_bucket} \
  --log_transfer_info.log_transfer_detail.obs_period=5 \
  --log_transfer_info.log_transfer_detail.obs_period_unit=min
ParameterRequiredDescription
--log_group_idYesSource log group ID
--log_streams.1.log_stream_idYesSource log stream ID
--log_transfer_info.log_transfer_typeYesOBS, DIS, or DMS
--log_transfer_info.log_transfer_modeYescycle (periodic) or realTime
--log_transfer_info.log_transfer_statusYesENABLE, DISABLE, or EXCEPTION
--log_transfer_info.log_storage_formatYesRAW or JSON
--log_transfer_info.log_transfer_detail.obs_bucket_nameYesTarget OBS bucket name
--log_transfer_info.log_transfer_detail.obs_periodYesTransfer period: 1,2,3,5,6,12,30
--log_transfer_info.log_transfer_detail.obs_period_unitYesmin or hour

4.2 List Transfers

bash
hcloud LTS ListTransfers --cli-region={region} \
  --log_transfer_type=OBS

4.3 Delete Transfer

bash
hcloud LTS DeleteTransfer --cli-region={region} \
  --log_transfer_id={transfer_id}

5. Diagnostic Workflows

5.1 Diagnose Traffic Surge

bash
# Step 1: TOP-N by write traffic (descending)
hcloud LTS ListTopnTrafficStatistics --cli-region={region} \
  --resource_type=log_stream --topn=10 \
  --start_time={start_ms} --end_time={end_ms} \
  --search_list.1=write --sort_by=write --is_desc=true

# Step 2: Timeline trend for the top log stream
hcloud LTS ListTimeLineTrafficStatistics --cli-region={region} \
  --resource_type=log_stream --search_type=write \
  --start_time={start_ms} --end_time={end_ms} \
  --period=1 --timezone=Asia/Shanghai \
  --resource_id={top_stream_id}

5.2 Diagnose Collection Break

bash
# Step 1: Find offline hosts
hcloud LTS ListHost --cli-region={region} --filter.host_status=offline

# Step 2: Find error-state hosts
hcloud LTS ListHost --cli-region={region} --filter.host_status=error

# Step 3: Check access configs
hcloud LTS ListAccessConfig --cli-region={region}

5.3 Diagnose Log Flooding

bash
# TOP-N by write traffic descending to find flooding log stream
hcloud LTS ListTopnTrafficStatistics --cli-region={region} \
  --resource_type=log_stream --topn=5 \
  --start_time={start_ms} --end_time={end_ms} \
  --search_list.1=write --sort_by=write --is_desc=true

6. Full Patrol Report

The full patrol report aggregates all inspection results:

bash
# 1. TOP-N traffic
hcloud LTS ListTopnTrafficStatistics --cli-region={region} \
  --resource_type=log_stream --topn=10 \
  --start_time={start_ms} --end_time={end_ms} \
  --search_list.1=write --sort_by=write --is_desc=true

# 2. Timeline traffic
hcloud LTS ListTimeLineTrafficStatistics --cli-region={region} \
  --resource_type=tenant --search_type=write \
  --start_time={start_ms} --end_time={end_ms} \
  --period=1 --timezone=Asia/Shanghai

# 3. Host groups
hcloud LTS ListHostGroup --cli-region={region}

# 4. Abnormal hosts
hcloud LTS ListHost --cli-region={region} --filter.host_status=offline
hcloud LTS ListHost --cli-region={region} --filter.host_status=error

# 5. Access configs
hcloud LTS ListAccessConfig --cli-region={region}

Output a structured report with:

  • Traffic statistics briefing (TOP-N + timeline)
  • Collection anomaly checklist (offline/error hosts + affected configs)

Parameter Confirmation

ParameterRequiredDescriptionExample
{region}YesHuawei Cloud regioncn-north-4
{log_group_id}YesLTS log group IDxxxx-xxxx-xxxx
{log_stream_id}YesLTS log stream IDxxxx-xxxx-xxxx
{start_time} / {end_time}YesTime range (format depends on command)1704067200000 (ms timestamp)
{topn}NoTOP-N count, range 1-10010
{line_num}Yes (context)Log line sequence numberfrom ListLogs result
{obs_bucket}Yes (transfer)Target OBS bucket namemy-log-backup
{keyword}NoSearch keyword for log queryerror

KooCLI Command Format Standard

bash
hcloud LTS <Operation> --cli-region=<region> [--key=value ...]
FeatureDescriptionExample
Service nameLTS (uppercase)hcloud LTS ListHostGroup
Operation namePascalCaseListTopnTrafficStatistics
Region parameter--cli-region=<value>--cli-region=cn-north-4
Simple parameter--key=value--topn=10
Indexed parameter--key.1=value1--search_list.1=write

Reference Documents

  • references/cli-installation-guide.md - hcloud CLI installation and configuration
  • references/iam-policies.md - Least-privilege IAM policies for LTS
  • references/verification-method.md - Verification and testing methods
  • references/dataflow-diagram.md - Mermaid data flow diagram
  • references/acceptance-criteria.md - Acceptance criteria
  • references/lts-api-reference.md - LTS API command quick reference
来自同一仓库

更多 Skills

全部 Skills
huaweicloud
社区

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

安装量
5
GitHub Stars
50
最近更新
9月23日
huaweicloud
社区

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

安装量
1
GitHub Stars
50
最近更新
9月22日
huaweicloud
社区

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

安装量
1
GitHub Stars
50
最近更新
9月22日
huaweicloud
社区

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

安装量
1
GitHub Stars
50
最近更新
9月22日