splunk - Splunk 搜索问题
问题描述
我有一个如下的搜索查询。
index = abc_dev sourcetype = data RequestorSystem = * Description="Request Receieved from Consumer Service"
OR Description="Total Time taken in sending response"
| dedup TId
| eval InBoundCount=if(Description="Request Receieved from Consumer Service",1,0)
| eval OutBoundCount=if(Description="Total Time taken in sending response",1,0)
| stats sum(InBoundCount) as "Inbound Count",sum(OutBoundCount) as "Outbound Count"
我不确定为什么入站计数始终显示为 0,出站计数工作正常
解决方案
您的eval InBoundCount=...
Received中有一个拼写错误,如果您的事件拼写正确,它将不匹配!
如果不是这样:
尝试分别对这两个计数运行查询,并确保您收到事件。此外,发布一些示例输入事件将使我们的答案更加准确。
Splunk 查询由隐式连接,
AND
这意味着您OR
需要包含在括号中或(如果您使用的是 Splunk 6.6 或更高版本)使用如下IN
关键字:index = abc_dev sourcetype = data RequestorSystem = * Description IN ("Request Receieved from Consumer Service", "Total Time taken in sending response")
如果您以后想添加其他字符串,则使用IN
更便携。通过一些调整,您甚至可以使用stats count by Description
this 的变体。
推荐阅读
- vim - 如何在 mac 上正确安装 YouCompleteMe?
- matplotlib - 设置 matplotlib 刻度
- python - 如何在没有不必要反射的情况下使用 SQLAlchemy 删除和重新创建表?
- sql-server - 无法连接到 SQL Server 2019 localdb
- javascript - 在我的计算机上运行 Node.js Discord 机器人时出现错误女巫 416 状态代码
- docker - 如何防止在 Kubernetes 中由 HPA 创建的新扩展的 Pod 在特定时间段内缩小?
- laravel - Laravel 资源总是返回 null
- java - 当消息中存在换行符时,HMAC SHA-256 不正确
- android - Flutter http.response 没有得到任何响应
- python - 尽管先前的 If 语句为 True,但仍执行了 Elif 语句