Splunk Search

What's the best way to find out events that have field values that DO NOT match?

atebysandwich
Path Finder

I have two lookups: one is the scan results from the current week and the other is historical lookup of scan results from the weeks prior. Each event is the scan results for a host (fields DNS IP). I have a field called called Host_Auth that can have of the following field values:

  • Windows Successful
  • Windows Failure
  • Unix Failed
  • Unix Successful
  • Unix Timeout
  • Windows Not Attempted 
  • Unix Not Attempted 
  • Unknown

I would like to create a search where the first lookup is compered against the second lookup and return events where the Host_Auth field value is is different. 

I tried a join type=left Host_Auth but that didn't quite work 

Labels (4)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The join command pairs events with the same values of the specified field.  It cannot be used to find differences.

To find differences, join events using another field (DNS, perhaps) then filter on the Host_Auth field.

<<search 1>>
| rename Host_Auth as Host_Auth_1
| join type=left DNS [ <<search 2>> | rename Host_Auth as Host_Auth_2 ]
| where Host_Auth_1 != Host_Auth_2

 My standard disclaimer applies: join is inefficient so consider using append or another method of combining results.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The join command pairs events with the same values of the specified field.  It cannot be used to find differences.

To find differences, join events using another field (DNS, perhaps) then filter on the Host_Auth field.

<<search 1>>
| rename Host_Auth as Host_Auth_1
| join type=left DNS [ <<search 2>> | rename Host_Auth as Host_Auth_2 ]
| where Host_Auth_1 != Host_Auth_2

 My standard disclaimer applies: join is inefficient so consider using append or another method of combining results.

---
If this reply helps you, Karma would be appreciated.

atebysandwich
Path Finder

This worked exactly as I was hoping. I changed the join to be looking for IP rather than DNS. 

Thank you for the help on this!

yuanliu
SplunkTrust
SplunkTrust

To build on @richgalloway's disclaimer😃, here's a possible alternative

(<<sourcetype=sourcetyp1 search 1>>) OR (<<sourcetype=sourcetype2 search 2>>) ``` replace sourcetype with any field that differentiates search 1 from search 2 ```
| eventstats dc(sourcetype) as sourcetypes by DNS Host_Auth
| where sourcetypes == 1

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...