日志模式生成器Skill log-schema-generator

日志模式生成器是一款用于创建结构化日志记录方案的专业工具。它能够自动生成包含日志级别标准(RFC 5424)、关联ID追踪模式以及ELK Stack、Splunk等主流日志平台集成模板的完整配置方案。该工具支持JSON、logfmt、ECS等多种日志格式标准化,内置上下文传播机制和个人身份信息(PII)掩码规则,帮助开发团队快速实现统一、可观测的日志系统。适用于微服务架构、分布式系统、云原生应用等场景的日志治理和运维监控需求。关键词:结构化日志,关联ID,ELK集成,Splunk配置,日志标准化,PII掩码,可观测性,微服务监控,日志分析,运维工具。

DevOps 0 次安装 0 次浏览 更新于 2/26/2026

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
      }
    }
  }
}