Splunk Search

Numeric Comparison on Eventtype?

Jason
Motivator

I'm dealing with a stream of monitoring data with good and bad events, but no text to distinguish them apart. Good vs. bad is defined as follows, by comparing the same two fields found in every event:

Good event: previous_status < current_status
Bad event: current_status < previous_status

I need to be able to eventtype and tag these events, but comparing two fields in the search command does not seem possible - I only got expected results by using a | where and that is not supported in an eventtype.

How do I eventtype this data properly?

And why can we only compare a field to a static numeric value in search, rather than another numeric field??

0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

No, you can't do this in a base search (or equivalently, in the search command), and therefore you can't specify this as an eventtype. I think this is a fairly straightforward and reasonable enhancement request.

View solution in original post

0 Karma

araitz
Splunk Employee
Splunk Employee

'search' assumes that the right side of the comparison is a string literal (i.e how x=y is processed on the right-most part of the search). 'where' treats both sides as variables rather than literals, similar to sql's 'where'.

Event types are designed to classify specific types of events, not comparisons of two or more events. You should probably look at alerting.

Jason
Motivator

I updated the question above with better clarity. Both fields are in the same event. I just need to compare the two fields to one another, and it seems a bit unreasonable that you have to use a separate command for this.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

No, you can't do this in a base search (or equivalently, in the search command), and therefore you can't specify this as an eventtype. I think this is a fairly straightforward and reasonable enhancement request.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

What he isn't making clear (which he did offline) is that the two fields he is comparing are two field in the same event. If they were in different events, I would agree with you, but for numeric comparisons of fields in the same events (not string comparisons, and not in different events) this is not really any different from what Splunk already does. Furthermore, for eventtyping, it would be okay even if the fields are non-numeric.

0 Karma

araitz
Splunk Employee
Splunk Employee

I disagree - this is far outside the design of eventtyping and tagging.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...