Skip to content
Back to skills

Fluentd Mysql慢查询日志正则解析配置

ASecurity

使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询统计和SQL语句四个字段,并处理字段长度限制和多行内容匹配。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationsqlexpressdevops

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'fluentd-mysql慢查询日志正则解析配置' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fluentd Mysql慢查询日志正则解析配置?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fluentd Mysql慢查询日志正则解析配置
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-fluentd-mysql/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-fluentd-mysql)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "4d42d244-a327-4741-b60b-eab063ee6830"
name: "Fluentd MySQL慢查询日志正则解析配置"
description: "使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询统计和SQL语句四个字段,并处理字段长度限制和多行内容匹配。"
version: "0.1.0"
tags:
  - "fluentd"
  - "regexp"
  - "mysql"
  - "log parsing"
  - "devops"
triggers:
  - "fluentd regexp mysql slow query"
  - "fluentd 解析mysql慢日志"
  - "fluentd 不用multiline解析多行日志"
  - "fluentd regexp 切分日志"
  - "fluentd mysql slow log config"
---

# 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.