ssh // 包含 ssh
ssh login // 包含 ssh 或者 login
"ssh login" // 包含 ssh login
// 正则匹配
/ethernet[0-9]+/
type:(ssh OR login) // 字段 type 包含 ssh 或者 login
// 必须 (不) 包含字段
_exists_:type
NOT _exists_:type
// 支持 `*`, `?` 两种通配符
source:xxx?yyy
source:xxx*yyy
// PS: 默认配置,通配符不能放在最前面,避免内存消耗太多
// 可以这样开启:
// allow_leading_wildcard_searches = true
// 模糊匹配 ~
ssh logni~ // 可以搜索到 ssh login
"foo bar"~5 // Damerau–Levenshtein distance
// 范围
http_response_code:[500 TO 504]
http_response_code:{400 TO 404}
bytes:{0 TO 64]
http_response_code:[0 TO 64}
// 大小
http_response_code:>400
http_response_code:<400
http_response_code:>=400
http_response_code:<=400
http_response_code:(>=400 AND <500)
// 时间范围
timestamp:["2019-07-23 09:53:08.175" TO "2019-07-23 09:53:08.575"]
otherDate:[now-5d TO now-4d]
此外,还有 AND,OR,NOT,括号等逻辑运算符可用。
转义符:
& | : \ / + - ! ( ) { } [ ] ^ " ~ * ?
参考资料与拓展阅读
- graylog, Searching
- elastic, Search in Depth