我试图在 Splunk 中查找与特定字符串不匹配的所有事件。就我而言,我正在尝试为 ResponseCode:401、ResponseCode:404 等的所有事件构建一个报告。我简短地说它可能是 200 以外的任何事件。
但不知道该怎么做。
以下是一些示例事件。
事件:
DNS:www.mybonuscenter.com Host:10.94.64.74 RequestMS:2414 EventTime:[06/Aug/2018:14:06:57 -0400] Request:"GET /bizrateapp/app.bundle.dd46e01d637d8dbcc456.js HTTP/1.1" ResponseCode:200 Size:414360
DNS:www.mybonuscenter.com Host:10.94.64.74 RequestMS:168 EventTime:[06/Aug/2018:14:11:50 -0400] Request:"GET /favicon.ico HTTP/1.1" ResponseCode:404 Size:209
使用正则表达式搜索头部命令:
index="my_cw_index" | regex (?:[^ResponseCode\:200]*)
输出
Error in 'SearchParser': Missing a search command before '^'. Error at position '39' of search query 'search index="syn_prod_cw" | regex (?:[^ResponseCo'.