rename: bms-test-log-query -> bms-log-test-query, bms-prd-log-query -> bms-log-prd-query
This commit is contained in:
parent
337e26858b
commit
ce97aba57d
123
.agents/skills/bms-log-prd-query/SKILL.md
Normal file
123
.agents/skills/bms-log-prd-query/SKILL.md
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
---
|
||||||
|
name: bms-log-prd-query
|
||||||
|
description: >
|
||||||
|
Query BMS production (bms-prod) logs from Elasticsearch via Kibana console proxy.
|
||||||
|
Use when the user asks to check BMS production logs, search prod errors, or look up bms-prod data.
|
||||||
|
All queries go through Kibana at https://kiblog.qx.com — ES direct port is NOT accessible.
|
||||||
|
metadata:
|
||||||
|
author: local
|
||||||
|
version: 1.0.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# BMS Production Log Query Skill
|
||||||
|
|
||||||
|
> **Scope: ONLY `bms-prod` data view → `*bms*,*wos*` indices.**
|
||||||
|
|
||||||
|
## Connection Details (DO NOT re-verify — confirmed working)
|
||||||
|
|
||||||
|
- **Auth**: Read from `~/.env` (home directory):
|
||||||
|
- `BMS_LOG_PRD_URL` = Kibana proxy URL
|
||||||
|
- `BMS_LOG_PRD_USERNAME` = elastic
|
||||||
|
- `BMS_LOG_PRD_PASSWORD` = (stored in .env)
|
||||||
|
- **ES Version**: 8.6.1
|
||||||
|
- **ES direct port**: NOT accessible. All queries go through Kibana console proxy.
|
||||||
|
|
||||||
|
## Data View Mapping
|
||||||
|
|
||||||
|
| Kibana Data View | ES Index Pattern |
|
||||||
|
|-----------------|------------------|
|
||||||
|
| `bms-prod` | `*bms*,*wos*` |
|
||||||
|
|
||||||
|
## Kibana Console Proxy Format
|
||||||
|
|
||||||
|
```
|
||||||
|
POST https://kiblog.qx.com/api/console/proxy?path=<URL_ENCODED_ES_PATH>&method=GET
|
||||||
|
```
|
||||||
|
|
||||||
|
Headers: `kbn-xsrf: true`, `Content-Type: application/json`
|
||||||
|
|
||||||
|
## Index Pattern
|
||||||
|
|
||||||
|
- `bmslog-bms-prod-YYYY-MM-DD` — daily rolling indices, ~10,000,000 docs/day (weekday), ~7,000,000 (weekend)
|
||||||
|
|
||||||
|
## Log Fields
|
||||||
|
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| `@timestamp` | ISO 8601 timestamp |
|
||||||
|
| `timestamp` | Original timestamp string |
|
||||||
|
| `message` | Log message (Chinese/English) |
|
||||||
|
| `level` | Log level: INFO, WARN, ERROR, etc. |
|
||||||
|
| `app_name` | Application name (e.g. `bms-web`) |
|
||||||
|
| `class` | Java class name |
|
||||||
|
| `thread` | Thread name |
|
||||||
|
| `traceId` | Distributed trace ID |
|
||||||
|
| `host_ip` | Host IP address |
|
||||||
|
| `log_origin` | Log origin identifier |
|
||||||
|
| `stack_trace` | Exception stack trace (empty if no error) |
|
||||||
|
|
||||||
|
## Query Patterns
|
||||||
|
|
||||||
|
### Latest N logs
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bmslog-bms-prod-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"sort": [{"@timestamp": "desc"}],
|
||||||
|
"size": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search by keyword
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bmslog-bms-prod-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"multi_match": {
|
||||||
|
"query": "<keyword>",
|
||||||
|
"fields": ["message", "stack_trace"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sort": [{"@timestamp": "desc"}],
|
||||||
|
"size": 20
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search errors
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bmslog-bms-prod-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{ "match": { "level": "ERROR" } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 20,
|
||||||
|
"sort": [{"@timestamp": "desc"}]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search by traceId
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bmslog-bms-prod-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"term": { "traceId": "<traceId>" }
|
||||||
|
},
|
||||||
|
"sort": [{"@timestamp": "asc"}],
|
||||||
|
"size": 100
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Count docs
|
||||||
|
```
|
||||||
|
GET /api/console/proxy?path=/bmslog-bms-prod-<DATE>/_count&method=GET
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
1. **Never re-probe ES connectivity** — Kibana proxy is the only working method
|
||||||
|
2. **Never try ES direct ports** — not accessible
|
||||||
|
3. **Never store credentials** in this file
|
||||||
|
4. **When user says "查 bms-prod" 或 "查生产日志" → query `bmslog-bms-prod-*` indices**
|
||||||
111
.agents/skills/bms-log-test-query/SKILL.md
Normal file
111
.agents/skills/bms-log-test-query/SKILL.md
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
---
|
||||||
|
name: bms-log-test-query
|
||||||
|
description: >
|
||||||
|
Query BMS (bms-sit) application logs from Elasticsearch via Kibana console proxy.
|
||||||
|
Use when the user asks to check BMS logs, search BMS errors, or look up recent log entries.
|
||||||
|
All queries go through Kibana at http://172.17.12.18:8000 — ES direct port is NOT accessible.
|
||||||
|
metadata:
|
||||||
|
author: local
|
||||||
|
version: 3.0.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# BMS Log Query Skill
|
||||||
|
|
||||||
|
> **Scope: ONLY `bms-sit` data view → `bms-test*` and `pms*` indices.**
|
||||||
|
|
||||||
|
## Connection Details (DO NOT re-verify — confirmed working)
|
||||||
|
|
||||||
|
- **Auth**: Read from `~/.env` (home directory):
|
||||||
|
- `BMS_LOG_TEST_URL` = Kibana proxy URL
|
||||||
|
- `BMS_LOG_TEST_USERNAME` = elastic
|
||||||
|
- `BMS_LOG_TEST_PASSWORD` = (stored in .env)
|
||||||
|
- **ES Version**: 8.6.1
|
||||||
|
- **ES direct port**: NOT accessible. All queries go through Kibana console proxy.
|
||||||
|
|
||||||
|
## Data View Mapping
|
||||||
|
|
||||||
|
| Kibana Data View | ES Index Pattern |
|
||||||
|
|-----------------|------------------|
|
||||||
|
| `bms-sit` | `bms-test*, pms*` |
|
||||||
|
|
||||||
|
## Kibana Console Proxy Format
|
||||||
|
|
||||||
|
```
|
||||||
|
POST http://172.17.12.18:8000/api/console/proxy?path=<URL_ENCODED_ES_PATH>&method=<HTTP_METHOD>
|
||||||
|
```
|
||||||
|
|
||||||
|
Headers: `kbn-xsrf: true`, `Content-Type: application/json`
|
||||||
|
|
||||||
|
## Index Pattern
|
||||||
|
|
||||||
|
- `bms-test-YYYY-MM-DD` — daily rolling indices, ~2,000,000 docs/day
|
||||||
|
- `pms-test-YYYY-MM-DD` — PMS test logs, ~59,000 docs/day
|
||||||
|
|
||||||
|
## Query Patterns
|
||||||
|
|
||||||
|
### Latest N logs
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bms-test-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"sort": [{"@timestamp": "desc"}],
|
||||||
|
"size": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search by keyword
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bms-test-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"multi_match": {
|
||||||
|
"query": "<keyword>",
|
||||||
|
"fields": ["message", "error.message", "original_message"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sort": [{"@timestamp": "desc"}],
|
||||||
|
"size": 20
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search errors in time range
|
||||||
|
```json
|
||||||
|
POST /api/console/proxy?path=/bms-test-<DATE>/_search&method=GET
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{ "range": { "@timestamp": { "gte": "now-1h", "lte": "now" } } },
|
||||||
|
{ "match_phrase": { "message": "ERROR" } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 20,
|
||||||
|
"sort": [{"@timestamp": "desc"}]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Count docs
|
||||||
|
```
|
||||||
|
GET /api/console/proxy?path=/bms-test-<DATE>/_count&method=GET
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get mapping (available fields)
|
||||||
|
```
|
||||||
|
GET /api/console/proxy?path=/bms-test-<DATE>/_mapping&method=GET
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Fields
|
||||||
|
|
||||||
|
- `@timestamp` — log timestamp
|
||||||
|
- `message` — main log message (Chinese/English)
|
||||||
|
- `original_message` — original unformatted message
|
||||||
|
- `log.level` — INFO, WARN, ERROR, etc.
|
||||||
|
- `error.message` — error details
|
||||||
|
- `host.name` — host/container name
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
1. **Never re-probe ES connectivity** — Kibana proxy is the only working method
|
||||||
|
2. **Never try ports 9200/9201/5601** — not accessible
|
||||||
|
3. **Never store credentials** in this file
|
||||||
|
4. **When user says "查 bms-sit" → query `bms-test-*` indices**
|
||||||
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
| 技能名 | 说明 | 环境变量 |
|
| 技能名 | 说明 | 环境变量 |
|
||||||
|--------|------|----------|
|
|--------|------|----------|
|
||||||
| `bms-test-log-query` | 查询 BMS 测试 (bms-sit) 应用日志,通过 Kibana (`http://172.17.12.18:8000`) 代理访问 ES,索引 `bms-test-*`,日均 200 万条 | `BMS_LOG_*` |
|
| `bms-log-test-query` | 查询 BMS 测试 (bms-sit) 应用日志,通过 Kibana (`http://172.17.12.18:8000`) 代理访问 ES,索引 `bms-test-*`,日均 200 万条 | `BMS_LOG_TEST_*` |
|
||||||
| `bms-prd-log-query` | 查询 BMS 生产 (bms-prod) 日志,通过 Kibana (`https://kiblog.qx.com`) 代理访问 ES,索引 `bmslog-bms-prod-*`,日均 1000 万条 | `BMS_PRD_LOG_*` |
|
| `bms-log-prd-query` | 查询 BMS 生产 (bms-prod) 日志,通过 Kibana (`https://kiblog.qx.com`) 代理访问 ES,索引 `bmslog-bms-prod-*`,日均 1000 万条 | `BMS_LOG_PRD_*` |
|
||||||
|
|
||||||
### 数据库查询类
|
### 数据库查询类
|
||||||
|
|
||||||
@ -36,5 +36,5 @@
|
|||||||
1. **在当前项目根目录下创建**:`<skill-name>/SKILL.md`(直接在项目根目录建文件夹)
|
1. **在当前项目根目录下创建**:`<skill-name>/SKILL.md`(直接在项目根目录建文件夹)
|
||||||
2. 编写 `SKILL.md`,包含连接信息、查询模板、使用规则
|
2. 编写 `SKILL.md`,包含连接信息、查询模板、使用规则
|
||||||
3. 凭据统一存放在 `~/.env` 中,不在技能文件里写密码
|
3. 凭据统一存放在 `~/.env` 中,不在技能文件里写密码
|
||||||
4. 环境变量加技能名前缀(如 `BMS_LOG_*`),避免冲突
|
4. 环境变量加技能名前缀(如 `BMS_LOG_TEST_*`、`BMS_LOG_PRD_*`),避免冲突
|
||||||
5. 完成后同步复制到 `~/.claude/skills/` 使全局生效
|
5. 完成后同步复制到 `~/.claude/skills/` 使全局生效
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user