name: log-schema-generator description: 生成包含关联ID模式和ELK/Splunk集成的结构化日志模式 allowed-tools:
- Bash
- Read
- Write
- Glob
日志模式生成器技能
概述
生成结构化日志模式定义,包括日志级别标准、关联ID模式和ELK/Splunk集成模板。
能力
- 结构化日志模式定义
- 日志级别标准(RFC 5424)
- 关联ID模式
- ELK Stack集成模板
- Splunk集成模板
- 日志格式标准化(JSON,logfmt)
- 上下文传播模式
- PII掩码规则
目标流程
- 可观测性实施
输入模式
{
"type": "object",
"required": ["services"],
"properties": {
"services": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"language": { "type": "string" },
"framework": { "type": "string" }
}
}
},
"format": {
"type": "string",
"enum": ["json", "logfmt", "ecs"],
"default": "json"
},
"integration": {
"type": "string",
"enum": ["elk", "splunk", "datadog", "cloudwatch"],
"default": "elk"
},
"options": {
"type": "object",
"properties": {
"includeCorrelationId": {
"type": "boolean",
"default": true
},
"includePiiMasking": {
"type": "boolean",
"default": true
},
"logLevels": {
"type": "array",
"default": ["debug", "info", "warn", "error", "fatal"]
},
"requiredFields": {
"type": "array",
"default": ["timestamp", "level", "message", "service"]
}
}
}
}
}
输出模式
{
"type": "object",
"properties": {
"schema": {
"type": "object",
"properties": {
"fields": { "type": "array" },
"requiredFields": { "type": "array" },
"format": { "type": "string" }
}
},
"correlationIdPattern": {
"type": "object",
"properties": {
"headerName": { "type": "string" },
"format": { "type": "string" },
"propagation": { "type": "string" }
}
},
"integrationConfig": {
"type": "object",
"description": "ELK/Splunk配置"
},
"piiMaskingRules": {
"type": "array"
},
"exampleLogs": {
"type": "array"
}
}
}
使用示例
{
kind: 'skill',
skill: {
name: 'log-schema-generator',
context: {
services: [
{ name: 'api-service', language: 'typescript', framework: 'express' }
],
format: 'json',
integration: 'elk',
options: {
includeCorrelationId: true,
includePiiMasking: true
}
}
}
}