Splunk Search

Search lookup for non-matching values

ldunzweiler
Engager

I have the following search (MySearch), which is tied to an alert.

index=exchange_smtp Context=authenticated OR EHLO | iplocation ipaddress | search Country != "United States" | transaction Session keepevicted=true | Search Context=authenticated | eval merged=user.Country | lookup user_location username as merged | search NOT target=* | table Data,Session,ipaddress,user,Country

I have a lookup file called smtpforeignip.csv with a search that populates and updates this file with ipaddress,user,Country.

I want to modify MySearch to do a comparison against smtpforeignip.csv. If there is a matching ipaddress I do not want the alert to trigger. I ONLY want the alert to trigger when there is a non-matching ipaddress.

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this. The NOT subsearch will exclude all those foreign ip address from the main result itself.

index=exchange_smtp Context=authenticated OR EHLO NOT [| inputlookup smtpforeignip.csv | table ipaddress ]| iplocation ipaddress | search Country != "United States" | transaction Session keepevicted=true | Search Context=authenticated | eval merged=user.Country | lookup user_location username as merged | search NOT target=* | table Data,Session,ipaddress,user,Country

View solution in original post

0 Karma

somesoni2
Revered Legend

Try like this. The NOT subsearch will exclude all those foreign ip address from the main result itself.

index=exchange_smtp Context=authenticated OR EHLO NOT [| inputlookup smtpforeignip.csv | table ipaddress ]| iplocation ipaddress | search Country != "United States" | transaction Session keepevicted=true | Search Context=authenticated | eval merged=user.Country | lookup user_location username as merged | search NOT target=* | table Data,Session,ipaddress,user,Country
0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...