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.

Ver código fuente

Cómo usar

  1. Copia el comando y revisa el paquete antes de instalarlo en tu entorno de agente.
  2. Consulta las herramientas, credenciales y entornos necesarios en el documento original.
  3. Describe las entradas y el resultado deseado; contrasta la salida con las fuentes.
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-lts-log-inspector

Antes de empezar

  • La instalación no incluye suscripción al modelo, cuota API ni permisos sobre tus archivos.
  • Las estrellas e instalaciones reflejan actividad, no una prueba independiente de calidad o seguridad.
Documento original del Skill

Contenido del repositorio de origen con títulos, ejemplos, código, tablas, enlaces e imágenes preservados.

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

Relacionados por tarea

del mismo repositorio

Más Skills

Todos los Skills
huaweicloud
Comunidad

huawei-cloud-billing-scout

Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use only when the user explicitly mentions 华为云 / Huawei Cloud / BSS and 余额/账单/对账/资源包/代金券/储值卡/企业或伙伴账务; refuses pay, renew, refund, delete.

instalaciones
3
GitHub Stars
59
Actualizado
26 oct
huaweicloud
Comunidad

huawei-cloud-cci-instance-management

Huawei Cloud CCI (Cloud Container Instance) full lifecycle management using hcloud CLI. Covers Namespace, Network, Deployment, StatefulSet, Pod creation/update/delete/status, EIPPool for public IP, logs and metrics. Two-step confirmation for all destructive operations (delete namespace cascades all resources under it). Use this skill when the user wants to operate CCI serverless containers via command line. Triggers: CCI, 云容器实例, serverless container, 容器实例, namespace, deployment, statefulset, pod

instalaciones
3
GitHub Stars
59
Actualizado
26 oct
huaweicloud
Comunidad

huawei-cloud-computing-query

Queries Huawei Cloud computing resources (ECS/BMS/IMS/AS), Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, BMS bare metal servers/flavors/quotas, IMS images/OS versions/members/quotas, and AS scaling groups/configs/policies/activity logs/lifecycle hooks/warm pools/quotas. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check BMS availability, browse images, or view auto-scaling group/policy sta

instalaciones
3
GitHub Stars
59
Actualizado
26 oct
huaweicloud
Comunidad

huawei-cloud-find-skills

Invoke this skill to search, list, query, discover, browse, find and install any Huawei Cloud (华为云) agent skill. Triggers include: "华为云", "华为云有什么skill", "华为云相关skill", "华为云agent skill 市场", "华为云skill类目", "explore Huawei Cloud skills", "show Huawei Cloud skill categories", "does a Huawei Cloud skill exist for...", "which Huawei Cloud skills exist", "搜索华为云技能", "查询华为云skill列表", "有没有管理ECS/OBS/RDS的skill", "帮我找 XX 华为云skill", "介绍 XX Skill 内容", "华为云 XX Skill 具体做什么", "安装华为云Skill".

instalaciones
3
GitHub Stars
59
Actualizado
26 oct