agentsclimarketplace

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

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/fluentd-mysql慢查询日志正则解析配置

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

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

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.6 KB, 655 tokens by cl100k_base, as published. Nobody here has run it

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.