noc*_*rno 5 splunk splunk-query
我的用例是提供每天特定错误(按特定模式搜索)的计数,并提供此类“错误”请求相对于每天处理的请求总数(不使用错误模式搜索)的百分比。无法为其形成适当的查询。基本查询是 -
获取每天的总计数:
index=my_index | bucket _time span=day | stats count by _time
Run Code Online (Sandbox Code Playgroud)
只获取每天的错误:
index=my_index "Error-Search-Pattern" | bucket _time span=day | stats count by _time
Run Code Online (Sandbox Code Playgroud)
如何合并两个计数以并排显示并显示错误:总百分比?
提前致谢。
尝试这个
index=my_index
| eval error=if(match(_raw,".*Error-Search-Pattern.*"), 1, 0)
| bucket _time span=1d
| stats count as total, count(eval(error==1)) as errored by _time
Run Code Online (Sandbox Code Playgroud)