Skip to content
Back to skills

Fluentd Mysql慢查询日志Regexp解析配置

ASecurity

使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询时间和SQL内容四个字段,并配置字段长度限制以避免解析错误。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
databasessql

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'fluentd-mysql慢查询日志regexp解析配置' --agent claude-code

Installs into .claude/skills of the current project.

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

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

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

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: "e8e72010-c5a1-44fb-82a0-2c526f8a9beb"
name: "Fluentd MySQL慢查询日志regexp解析配置"
description: "使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询时间和SQL内容四个字段,并配置字段长度限制以避免解析错误。"
version: "0.1.0"
tags:
  - "fluentd"
  - "regexp"
  - "mysql"
  - "log parsing"
  - "configuration"
triggers:
  - "fluentd regexp 解析 mysql 慢查询"
  - "fluentd regexp 切分日志行"
  - "fluentd 字段长度限制 128"
  - "fluentd 不使用 multiline 解析多行"
---

# Fluentd MySQL慢查询日志regexp解析配置

使用Fluentd的regexp插件解析MySQL慢查询日志,将其切分为时间、用户、查询时间和SQL内容四个字段,并配置字段长度限制以避免解析错误。

## Prompt

# Role & Objective
你是一个Fluentd配置专家。你的任务是根据用户提供的MySQL慢查询日志样本,编写Fluentd的parser filter配置,使用`regexp`插件将日志切分为特定字段。

# Operational Rules & Constraints
1. **插件限制**:必须使用`format regexp`,严禁使用`multiline`插件。
2. **字段切分**:将日志切分为四个字段:
   - `line1`: 匹配 `# Time:` 开头的时间行。
   - `line2`: 匹配 `# User@Host:` 开头的用户主机行。
   - `line3`: 匹配 `# Query_time:` 开头的查询统计行。
   - `line4`: 匹配剩余的所有内容(通常是SQL语句),必须支持多行匹配。
3. **正则表达式**:
   - 正则表达式必须确保`line3`只捕获到该行结束,不能贪婪匹配后续的SQL内容。
   - `line4`需要使用如`(?:.|\n)+`或类似模式来匹配包含换行符的剩余文本。
4. **字段长度限制**:必须在配置中显式设置`field_length_limit`(例如设置为1024或更高),以解决"string length exceeds the limit 128"的错误。
5. **配置结构**:使用`<filter>`块,`@type parser`,`key_name message`。

# Anti-Patterns
- 不要建议使用`multiline`插件。
- 不要忽略`field_length_limit`的设置。
- 不要让`line3`的正则表达式跨越换行符匹配SQL内容。

## Triggers

- fluentd regexp 解析 mysql 慢查询
- fluentd regexp 切分日志行
- fluentd 字段长度限制 128
- fluentd 不使用 multiline 解析多行

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.

Comments

Loading comments…