我在一个索引(Student_Entry)中有 4 个字段(Name
、、、、)age
,我想添加事件总数,但我想排除那些在主题字段中具有任何值的事件。class
subject
我尝试了以下两种方法
index=Student_Entry Subject !=* | stats count by event
index=Student_Entry NOT Subject= * | stats count by event
我在一个索引(Student_Entry)中有 4 个字段(Name
、、、、)age
,我想添加事件总数,但我想排除那些在主题字段中具有任何值的事件。class
subject
我尝试了以下两种方法
index=Student_Entry Subject !=* | stats count by event
index=Student_Entry NOT Subject= * | stats count by event
和运算符类似,但不等价 NOT
。将返回在主题字段中没有值的事件,而不会。在您的情况下,使用. 请参阅https://docs.splunk.com/Documentation/Splunk/8.0.4/Search/NOTexpressions!=
NOT
!=
!=
stats count by event
什么都不做,因为没有称为“事件”的字段。要计算事件,只需使用stats count
.
你也可以这样做:
index=Student_Entry
| where isnull(subject)
| stats count
看起来你是对的index=Student_Entry Subject !=*
然后你只能添加 -| stats count