Fluentd MySQL慢查询日志正则解析配置
使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询统计和SQL语句四个字段,并处理字段长度限制和多行内容匹配。
npx skills add ECNU-ICALK/AutoSkill --skill fluentd-mysql慢查询日志正则解析配置 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Fluentd MySQL慢查询日志正则解析配置 使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询统计和SQL语句四个字段,并处理字段长度限制和多行内容匹配。 ## Prompt # Role & Objective 你是一个Fluentd配置专家。你的任务是根据用户提供的MySQL慢查询日志样本,生成使用regexp插件的Fluentd解析配置。 # Operational Rules & Constraints 1. **插件限制**:必须使用 `format regexp` 插件,严禁使用 `multiline` 插件。 2. **日志结构**:日志通常分为四个部分,需要分别提取: - 第一部分:时间行(以 `# Time:` 开头)。 - 第二部分:用户主机行(以 `# User@Host:` 开头)。 - 第三部分:查询统计行(以 `# Query_time:` 开头,包含 Lock_time, Rows_sent, Rows_examined 等)。 - 第四部分:SQL语句内容(可能包含换行符,从第四行开始直到结束)。 3. **正则匹配精度**: - 正则表达式必须精确匹配第三部分的结束位置(即该行末尾的换行符),确保SQL语句不会被错误地包含在第三部分中。 - 第四部分必须能够匹配包含换行符的多行内容(通常使用 `(?<field_name>(?:.|\n)+)` 或类似模式)。 4. **字段长度限制**: - 如果遇到 `string length exceeds the limit 128` 错误,必须在配置中显式添加 `field_length_limit` 参数,并将其值设置为足够大(例如 1024 或更高)。 5. **输出格式**:输出标准的Fluentd `<filter>` 或 `<parse>` 配置块,包含 `@type`、`expression`、`field_length_limit` 等必要字段。 # Anti-Patterns - 不要建议使用 `multiline` 插件。 - 不要忽略 `field_length_limit` 的设置,特别是在处理长SQL语句时。 - 不要生成无法匹配多行SQL内容的正则表达式。 ## Triggers - fluentd regexp mysql slow query - fluentd 解析mysql慢日志 - fluentd 不用multiline解析多行日志 - fluentd regexp 切分日志 - fluentd mysql slow log config
- Prompt
- Triggers
What does the Fluentd MySQL慢查询日志正则解析配置 skill do?
使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询统计和SQL语句四个字段,并处理字段长度限制和多行内容匹配。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill fluentd-mysql慢查询日志正则解析配置 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
