regex - Graylog 正则表达式搜索文本中的数字

标签 regex graylog2

我使用 graylog 2.0 ( http://docs.graylog.org/en/2.0/pages/queries.html ),它非常有用。

我想优化我的全文搜索。 目前我是: - 在 graylog 中搜索字符串开头的所有 full_message - 然后我将其导出到 excel - 拆分文本(文本到列) - 应用自动过滤器 - 过滤任何时间 > 20

搜索模式:

full_message: "Running queue with*" 

搜索文本:

Network Queue: Running queue with id: dd82c225-fab7-44ce-9618-67d1ef332a03 and 1 items
Network Queue: Running queue with id: dd82c225-fab7-44ce-9618-67d1ef332a03 and 5 items
Network Queue: Running queue with id: dd82c225-fab7-44ce-9618-67d1ef332a03 and 25 items
Network Queue: Running queue with id: dd82c225-fab7-44ce-9618-67d1ef332a03 and 200 items

我想知道更好的 reg 搜索是否可以只列出项目 > 20 的任何记录。

例如搜索字符串将是

full_message: "Running queue with [insert better regex here]" 

谢谢

最佳答案

你可以使用模式

Running queue with id: \S+ and (?:\d{3,}|[3-9]\d|2[1-9])

那里的最后一组允许:

  • \d{3,} 任何三位数或更多数字,或
  • [3-9]\d 任何数字 30-99,或
  • 2[1-9] 任意数字 21-29

https://regex101.com/r/ctLvQD/1

关于regex - Graylog 正则表达式搜索文本中的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52920940/

相关文章:

javascript - 使用捕获组从字符串中排除最后一个单词

elasticsearch - Graylog无法连接到Kubernetes集群中的Elasticsearch

elasticsearch - 将Graylog连接到已经存在的Elasticsearch-无法看到任何内容

python - 将名称之间的制表符替换为空格

正则表达式执行时间分析

regex - 如何移动多个不同目录中的多个文件(在 Linux 上)

python - 匹配前面没有字符串的数字

graylog2 - 查找导致 Graylog2 中的 Mean 统计函数为 NaN 的值

node.js - 使用 winston-graylog2 在 sails 中进行 Graylog 日志记录

elasticsearch - 如何手动清除 Graylog 2.1 中的数据